<commit_before># -*- coding: utf-8 -*-

import tornado.ioloop
import tornado.web
import tornado.httputil

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        self.write("Hello, world")

class RegisterHandler(tornado.web.RequestHandler):

    def get(self):
        self.set_status(404)
        self.finish()

    def post(self):
        self.write(self.request.remote_ip)

def make_app():
    return tornado.web.Application([
        (r"/", MainHandler),
        (r"/register", RegisterHandler)
    ])

if __name__ == "__main__":<commit_msg>1.保存IP 2.重定向<commit_after># -*- coding: utf-8 -*-

import tornado.ioloop
import tornado.web
import tornado.httputil

remote_ip = None

class MainHandler(tornado.web.RequestHandler):
    def get(self):
        if remote_ip is None:
            self.write("register first")
        else:
            self.redirect(remote_ip)

class RegisterHandler(tornado.web.RequestHandler):

    def get(self):
        self.set_status(404)
        self.finish()

    def post(self):
        remote_ip = self.request.remote_ip
        self.write("OK")

def make_app():
    return tornado.web.Application([
        (r"/", MainHandler),
        (r"/register", RegisterHandler)
    ])

if __name__ == "__main__":
{'fraction_non_alphanumeric': 0.13227091633466134, 'fraction_numerical': 0.00796812749003984, 'mean_word_length': 2.8292682926829267, 'pattern_counts': {'":': 2, '<': 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': '7280417', 'n_tokens_mistral': 419, 'n_tokens_neox': 397, 'n_words': 80}