<commit_before>import os
import wsgiref.handlers
import logging

from google.appengine.api import memcache

from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app

from data_model import PhoneLog
import config

class MainHandler(webapp.RequestHandler):

  def post(self):
      # this handler should never get called
      logging.error("The MainHandler should never get called... %s" % self.request)
      self.error(204)

  def get(self):
      self.post()
      
## end MainHandler()

class EventLoggingHandler(webapp.RequestHandler):
    def post(self):
      # log this event...
      log = PhoneLog()
      log.phone = self.request.get('phone')
      log.body = self.request.get('inboundBody')
      log.smsID = self.request.get('sid')
      log.outboundSMS = self.request.get('outboundBody')
      log.put()
    
## end EventLoggingHandler


class ResetQuotaHandler(webapp.RequestHandler):
    def get(self):
        logging.info("deleting the memcached quotas for the day...")<commit_msg>cleanup XMPP handlers preserving the user email address, before storing it in the PhoneLog<commit_after>import os
import wsgiref.handlers
import logging

from google.appengine.api import memcache

from google.appengine.ext import webapp
from google.appengine.ext.webapp import template
from google.appengine.ext.webapp.util import run_wsgi_app

from data_model import PhoneLog
import config

class MainHandler(webapp.RequestHandler):

  def post(self):
      # this handler should never get called
      logging.error("The MainHandler should never get called... %s" % self.request)
      self.error(204)

  def get(self):
      self.post()
      
## end MainHandler()

class EventLoggingHandler(webapp.RequestHandler):
    def post(self):
      # normalize the XMPP requests
      if self.request.get('phone').find('@'):
          caller = self.request.get('phone').split('/')[0]
      else:
      	  caller = self.request.get('phone')
      # log this event...
      log = PhoneLog()
      log.phone = caller
      log.body = self.request.get('inboundBody')
      log.smsID = self.request.get('sid')
      log.outboundSMS = self.request.get('outboundBody')
      log.put()
    
## end EventLoggingHandler


class ResetQuotaHandler(webapp.RequestHandler):
    def get(self):
        logging.info("deleting the memcached quotas for the day...")
{'fraction_non_alphanumeric': 0.10612916495269437, 'fraction_numerical': 0.002879473467708762, 'mean_word_length': 3.3898916967509027, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '687608', 'n_tokens_mistral': 737, 'n_tokens_neox': 721, 'n_words': 189}