<commit_before>"""`main` is the top level module for your Bottle application.

Loads the Bottle framework and adds a custom error
handler.
"""

# import the Bottle framework
from bottle import Bottle
from google.appengine.api import users
from bottle import route, request, run, redirect
import json
import urllib
from google.appengine.api import urlfetch
from google.appengine.ext import ndb

def verify_service(requestJSON, url):
      params = urllib.urlencode({'jsonrequest': requestJSON})
      print params
      deadline = 60
    
      result = urlfetch.fetch(url=url,
                                payload=params,
                                method=urlfetch.POST,
                                deadline=deadline,
                                headers={'Content-Type': 'application/x-www-form-urlencoded'})
      return result.content


# Run the Bottle wsgi application. We don't need to call run() since our
# application is embedded within an App Engine WSGI application server.
bottle = Bottle()

'''
@bottle.route('/api/get_bots')
def use_verify_service():
  return "I return this"
  
  bots = Bot.query().fetch(100)
  result = []
  for bot in bots:
    result.append(bot.to_dict())
  return json.dumps(result) 
'''
@bottle.error(404)
def error_404(error):
  """Return a custom 404 error."""
  return 'Sorry, Nothing at this URL.'

@bottle.post('/api/verify_service_m')
def verify_service_m(): io.
  bots_code_m = request.forms.get("bots_code")
  #syntax testing
  bots_code_m+="function aguess(a,b,c,d){ return [1,1] }";
  tests_m = request.forms.get("tests");
  d = {"tests":tests_m, "solution":bots_code_m}
  url = "http://192.168.3.11/js"
  requestJSON = json.dumps(d)
  result = verify_service(requestJSON,url)
  print result 
  return result<commit_msg>deploy 33<commit_after>"""`main` is the top level module for your Bottle application.

Loads the Bottle framework and adds a custom error
handler.
"""

# import the Bottle framework
from bottle import Bottle
from google.appengine.api import users
from bottle import route, request, run, redirect
import json
import urllib
from google.appengine.api import urlfetch
from google.appengine.ext import ndb

def verify_service(requestJSON, url):
      params = urllib.urlencode({'jsonrequest': requestJSON})
      print params
      deadline = 60
    
      result = urlfetch.fetch(url=url,
                                payload=params,
                                method=urlfetch.POST,
                                deadline=deadline,
                                headers={'Content-Type': 'application/x-www-form-urlencoded'})
      return result.content


# Run the Bottle wsgi application. We don't need to call run() since our
# application is embedded within an App Engine WSGI application server.
bottle = Bottle()

'''
@bottle.route('/api/get_bots')
def use_verify_service():
  return "I return this"
  
  bots = Bot.query().fetch(100)
  result = []
  for bot in bots:
    result.append(bot.to_dict())
  return json.dumps(result) 
'''
@bottle.error(404)
def error_404(error):
  """Return a custom 404 error."""
  return 'Sorry, Nothing at this URL.'

@bottle.post('/api/verify_service_m')
def verify_service_m():
  bots_code_m = request.forms.get("bots_code")
  #syntax testing
  bots_code_m+="function aguess(a,b,c,d){ return [1,1] }";
  tests_m = request.forms.get("tests");
  d = {"tests":tests_m, "solution":bots_code_m}
  url = "http://192.168.3.11/js"
  requestJSON = json.dumps(d)
  result = verify_service(requestJSON,url)
  print result 
  return result
{'fraction_non_alphanumeric': 0.11332958380202475, 'fraction_numerical': 0.014623172103487065, 'mean_word_length': 3.136046511627907, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '25723', 'n_tokens_mistral': 1167, 'n_tokens_neox': 1103, 'n_words': 305}