<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-

""" main.py
IP(REMOTE_ADDR) viewer on Google App Engine

"""

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

import os

class IndexPage(webapp.RequestHandler):
    def get(self):
        host = os.environ['HTTP_HOST']
        self.response.out.write("""
<!DOCTYPE html>
<html>
<body>
<a href="http://%s/ip">ip</a><br />
<br />
<a href="http://twitter.com/wataken44">@wataken44</a>
</body>
</html>
""" % host)

    def head(self):
        pass

class IPPage(webapp.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        addr = os.environ['REMOTE_ADDR']
        self.response.out.write(addr)

    def head(self):
        pass

def main():
    application = webapp.WSGIApplication(
        [('/', IndexPage),
         ('/ip', IPPage)]
        )<commit_msg>add: Access-Control-Allow-Origin header for IP<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-

""" main.py
IP(REMOTE_ADDR) viewer on Google App Engine

"""

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

import os

class IndexPage(webapp.RequestHandler):
    def get(self):
        host = os.environ['HTTP_HOST']
        self.response.out.write("""
<!DOCTYPE html>
<html>
<body>
<a href="http://%s/ip">ip</a><br />
<br />
<a href="http://twitter.com/wataken44">@wataken44</a>
</body>
</html>
""" % host)

    def head(self):
        pass

class IPPage(webapp.RequestHandler):
    def get(self):
        self.response.headers['Content-Type'] = 'text/plain'
        self.response.headers['Access-Control-Allow-Origin'] = '*'
        addr = os.environ['REMOTE_ADDR']
        self.response.out.write(addr)

    def head(self):
        pass

def main():
    application = webapp.WSGIApplication(
        [('/', IndexPage),
         ('/ip', IPPage)]
        )
{'fraction_non_alphanumeric': 0.17425025853154086, 'fraction_numerical': 0.005170630816959669, 'mean_word_length': 2.9814814814814814, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, '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': '267445', 'n_tokens_mistral': 690, 'n_tokens_neox': 661, 'n_words': 129}