Support X-Forwarded-For header
This commit is contained in:
parent
34e20ead6e
commit
2427084fe2
79
ab.txt
79
ab.txt
|
@ -785,3 +785,82 @@ kochen;bekocht werden
|
||||||
4 Söhne;4 Töchter
|
4 Söhne;4 Töchter
|
||||||
dreckiges Bad;dreckige Küche
|
dreckiges Bad;dreckige Küche
|
||||||
schnell;sorgfältig
|
schnell;sorgfältig
|
||||||
|
Barfuß;Socken
|
||||||
|
Unsichtbar sein;Gedanken lesen
|
||||||
|
Unterwasser atmen;Fliegen können
|
||||||
|
Jogginghose;Jeans
|
||||||
|
Samstag;Sonntag
|
||||||
|
Schwitzen;Frieren
|
||||||
|
Die;das Nutella
|
||||||
|
Android;iPhone
|
||||||
|
Stadt;Dorf
|
||||||
|
McDonald's;Burger King
|
||||||
|
Schokolade;Chips
|
||||||
|
Aufzug;Treppe
|
||||||
|
Hund;Katze
|
||||||
|
Sommer;Winter
|
||||||
|
Herbst;Frühling
|
||||||
|
Cola;Pepsi
|
||||||
|
Reisen;Balkonien
|
||||||
|
Strandurlaub;Städtetrip
|
||||||
|
Weihnachten;Ostern
|
||||||
|
Viel Geld;viel Freizeit
|
||||||
|
Reich;berühmt
|
||||||
|
Geburtstag;Weihnachten
|
||||||
|
Frühstück;Abendessen
|
||||||
|
Star Wars;Star Trek
|
||||||
|
Harry Potter;Herr der Ringe
|
||||||
|
Marvel;DC
|
||||||
|
Bösewicht;Superheld
|
||||||
|
Süßes;salziges Popcorn
|
||||||
|
Disney;Anime
|
||||||
|
Film;Serie
|
||||||
|
Vampir;Werwolf
|
||||||
|
Drachen;Einhörner
|
||||||
|
Horror;Comedy
|
||||||
|
Kino;Netflix
|
||||||
|
Germany's Next Topmodel;Der Bachelor
|
||||||
|
Rache;Vergebung
|
||||||
|
Fühlen;schmecken
|
||||||
|
Bier;Wein
|
||||||
|
Butter;Margarine
|
||||||
|
Ketchup;Majo
|
||||||
|
Britney;Christina
|
||||||
|
Optimist;Pessimist
|
||||||
|
Realist;Träumer
|
||||||
|
Regen;Schnee
|
||||||
|
Tattoo;Piercing
|
||||||
|
Kleid;Rock
|
||||||
|
Sneaker;Highheels
|
||||||
|
Singen;Tanzen
|
||||||
|
Pest;Cholera
|
||||||
|
Charakter;Aussehen
|
||||||
|
Intelligenz;Humor
|
||||||
|
Kochen;Bestellen
|
||||||
|
Geld;Ruhm
|
||||||
|
Chillen;Sport
|
||||||
|
Jünger;älter
|
||||||
|
Nie wieder Musik hören;immer den gleichen Song
|
||||||
|
Gegensätze;Gemeinsamkeiten
|
||||||
|
Diskutieren;Schweigen
|
||||||
|
Herz;Kopf
|
||||||
|
Nachteule;Frühaufsteher
|
||||||
|
Telefonieren;Schreiben
|
||||||
|
Zusammenziehen;getrennte Wohnungen
|
||||||
|
Reisen;Zuhause
|
||||||
|
Geschichte;Zukunft
|
||||||
|
Ehrlichkeit;Notlügen
|
||||||
|
Geld ausgeben;Sparen
|
||||||
|
Romantik;Abenteuer
|
||||||
|
Heiraten;wilde Ehe
|
||||||
|
Kuscheln;Küssen
|
||||||
|
Kinder;keine Kinder
|
||||||
|
Beziehung;Freundschaft-Plus
|
||||||
|
Sex mit der/dem Ex: Ja;Nein
|
||||||
|
Oben;unten
|
||||||
|
Mit;ohne Vorspiel
|
||||||
|
Missionarstellung;Reiterstellung
|
||||||
|
Oral;Anal
|
||||||
|
Sanft;leidenschaftlich
|
||||||
|
Sex-Toys;Dirty Talk
|
||||||
|
Fesseln;Augenbinde
|
||||||
|
|
12
game.py
12
game.py
|
@ -22,6 +22,11 @@ tz = pytz.timezone('Europe/Berlin')
|
||||||
def log_the_request(response):
|
def log_the_request(response):
|
||||||
now = datetime.now(tz=tz)
|
now = datetime.now(tz=tz)
|
||||||
|
|
||||||
|
if 'X-Forwarded-For' in request.headers:
|
||||||
|
remote_addr = request.headers['X-Forwarded-For']
|
||||||
|
else:
|
||||||
|
remote_addr = request.remote_addr
|
||||||
|
|
||||||
if not request.remote_user:
|
if not request.remote_user:
|
||||||
remote_user = "-"
|
remote_user = "-"
|
||||||
else:
|
else:
|
||||||
|
@ -38,7 +43,7 @@ def log_the_request(response):
|
||||||
full_path = request.full_path
|
full_path = request.full_path
|
||||||
|
|
||||||
log = {
|
log = {
|
||||||
'remote_addr': request.remote_addr,
|
'remote_addr': remote_addr,
|
||||||
'remote_user': remote_user,
|
'remote_user': remote_user,
|
||||||
'url': full_path,
|
'url': full_path,
|
||||||
'date': now.strftime("%d/%b/%Y:%H:%M:%S %z"),
|
'date': now.strftime("%d/%b/%Y:%H:%M:%S %z"),
|
||||||
|
@ -52,6 +57,7 @@ def log_the_request(response):
|
||||||
logfile = "{} - {} [{}] \"{} {}\" {} {} \"{}\" \"{}\"".format(log['remote_addr'], log['remote_user'], log['date'], log['method'], log['url'], log['status_code'], log['content_length'], log['referrer'], log['user_agent'])
|
logfile = "{} - {} [{}] \"{} {}\" {} {} \"{}\" \"{}\"".format(log['remote_addr'], log['remote_user'], log['date'], log['method'], log['url'], log['status_code'], log['content_length'], log['referrer'], log['user_agent'])
|
||||||
logger.info(logfile)
|
logger.info(logfile)
|
||||||
|
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
|
@ -68,13 +74,13 @@ def hello():
|
||||||
{'A': str(ab[0]), 'B': str(ab[1])}
|
{'A': str(ab[0]), 'B': str(ab[1])}
|
||||||
)
|
)
|
||||||
|
|
||||||
with open("ab.txt", "rbU") as f:
|
with open("ab.txt", "r") as f:
|
||||||
num_lines = sum(1 for _ in f)
|
num_lines = sum(1 for _ in f)
|
||||||
|
|
||||||
return render_template('index.html', title=title, separator=separator, content=ablines, num_lines=num_lines)
|
return render_template('index.html', title=title, separator=separator, content=ablines, num_lines=num_lines)
|
||||||
|
|
||||||
def getContent():
|
def getContent():
|
||||||
lines = [a.strip() for a in open("ab.txt").readlines()]
|
lines = [a.strip() for a in open("ab.txt", "r").readlines()]
|
||||||
result = [choice(lines) for a in range(5)]
|
result = [choice(lines) for a in range(5)]
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
Loading…
Reference in New Issue