Made an application for supporting sustainable local businesses in San Pancho.
Never really got completed, but it has some useful Svelte components for maps that we can reuse.
http://greenspots.dctrl.space
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
975 B
31 lines
975 B
2 years ago
|
from flask import Flask, request
|
||
|
from datetime import date
|
||
|
import os
|
||
|
|
||
|
app = Flask(__name__)
|
||
|
|
||
|
ip_addresses = {"187.144.10.199":[date.today()],"187.144.103.54":[date.today()],"187.144.121.210":[date.today()],"187.144.34.230":[date.today()],"187.144.46.100":[date.today()],"187.144.62.186":[date.today()],"187.144.78.121":[date.today()],"201.175.204.74":[date.today()],"209.52.88.22":[date.today()],"24.69.148.186":[date.today()]}
|
||
|
|
||
|
@app.route("/api")
|
||
|
def ip_tracker():
|
||
|
if request.headers.getlist("X-Forwarded-For"):
|
||
|
ip = request.headers.getlist("X-Forwarded-For")[0]
|
||
|
else:
|
||
|
ip = request.remote_addr
|
||
|
|
||
|
visits = ip_addresses.get(ip)
|
||
|
|
||
|
if visits == None:
|
||
|
ip_addresses[ip] = [date.today()]
|
||
|
else:
|
||
|
today = date.today()
|
||
|
if today not in ip_addresses[ip]:
|
||
|
ip_addresses[ip].append(today)
|
||
|
|
||
|
return {
|
||
|
"length": len(ip_addresses),
|
||
|
"data": ip_addresses,
|
||
|
"user": ip
|
||
|
}
|
||
|
|