Spaces:
Running
Running
Commit
·
faf6209
1
Parent(s):
31c4438
Update main.py
Browse files
main.py
CHANGED
@@ -32,25 +32,7 @@ def encode_url(url):
|
|
32 |
finished = urlunsplit((scheme, netloc, path, encoded_query_string, fragment))
|
33 |
print('ENCODED',finished)
|
34 |
return finished
|
35 |
-
|
36 |
-
def load_exception_urls():
|
37 |
-
url = os.environ['EXCEPTIONS']
|
38 |
-
response = requests.get(url)
|
39 |
-
return pkl.loads(response.content)
|
40 |
-
|
41 |
-
def save_exception_urls(exception_urls):
|
42 |
-
url = os.environ['EXCEPTIONS']
|
43 |
-
data = pkl.dumps(exception_urls)
|
44 |
-
requests.put(url, data=data)
|
45 |
|
46 |
-
def get_ip_info(ip_address):
|
47 |
-
try:
|
48 |
-
response = requests.get(f"http://ipinfo.io/{ip_address}/json")
|
49 |
-
data = response.json()
|
50 |
-
return data
|
51 |
-
except Exception as e:
|
52 |
-
return {"error": str(e)}
|
53 |
-
|
54 |
from geolite2 import geolite2
|
55 |
def get_location(ip):
|
56 |
start_time = time.time()
|
|
|
32 |
finished = urlunsplit((scheme, netloc, path, encoded_query_string, fragment))
|
33 |
print('ENCODED',finished)
|
34 |
return finished
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
from geolite2 import geolite2
|
37 |
def get_location(ip):
|
38 |
start_time = time.time()
|