<commit_before>from phiDi import phidi
from phiDi import loadPage
import urllib

import webapp2

querryName = "q"

class MainPage(webapp2.RequestHandler):

  def get(self): 
    self.response.headers["Content-Type"] = "text/html"
    self.response.out.write("""
        <form action="/phidi">
            <input type="text"name="q">
            <input type="submit">
        </form>
        """)


class PhidiHandler(webapp2.RequestHandler):

    def get(self):
        
        self.response.headers["Content-Type"] = "text/plain"
        
        articleName = self.request.get(urllib.unquote(querryName))
        # replace whitespaces to get a valid url
        articleName = articleName.replace(" ", "_")
        #self.response.out.write('Distance of '+ articleName + ": " + str(phidi.getDistanceTo(articleName)))
        self.response.out.write(articleName)


app = webapp2.WSGIApplication([('/', MainPage), ('/phidi', PhidiHandler)], debug=True)
<commit_msg>used unquote and decode to get recent input out of url parameter<commit_after>from phiDi import phidi
from phiDi import loadPage
import urllib

import webapp2

querryName = "q"

class MainPage(webapp2.RequestHandler):

  def get(self): 
    self.response.headers["Content-Type"] = "text/html"
    self.response.out.write("""
        <form action="/phidi">
            <input type="text"name="q">
            <input type="submit">
        </form>
        """)


class PhidiHandler(webapp2.RequestHandler):

    def get(self):
        
        self.response.headers["Content-Type"] = "text/plain"
        
        articleName = self.request.get(urllib.unquote(querryName))
        # replace whitespaces to get a valid url
        articleName = articleName.replace(" ", "_")
        #self.response.out.write('Distance of '+ articleName + ": " + str(phidi.getDistanceTo(articleName)))
        self.response.out.write(urllib.unquote(articleName).decode("iso8859-15"))


app = webapp2.WSGIApplication([('/', MainPage), ('/phidi', PhidiHandler)], debug=True)

{'fraction_non_alphanumeric': 0.14136904761904762, 'fraction_numerical': 0.006944444444444444, 'mean_word_length': 3.1079429735234214, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 11, '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': '990836', 'n_tokens_mistral': 635, 'n_tokens_neox': 616, 'n_words': 123}