Spaces:
Running
Running
Commit
·
0abe2d7
1
Parent(s):
71cc3fe
Update main.py
Browse files
main.py
CHANGED
@@ -36,6 +36,7 @@ def proxy(url):
|
|
36 |
req = requests.get(f'http://{url}', stream=True, timeout=5)
|
37 |
return Response(req.iter_content(chunk_size=10*1024), content_type=req.headers['content-type'])
|
38 |
except requests.exceptions.RequestException as e:
|
|
|
39 |
retries -= 1
|
40 |
return send_file('static/error.png', mimetype='image/png')
|
41 |
|
@@ -51,7 +52,6 @@ def index():
|
|
51 |
timezone = pytz.timezone(info['timezone'])
|
52 |
time = dt.datetime.now(timezone)
|
53 |
loc = info['loc']
|
54 |
-
print(info)
|
55 |
X, Y = latlon_to_pixel(info['loc'])
|
56 |
proxy_url = 'proxy/' + url.split('http://')[-1]
|
57 |
return render_template('index.html', name=name, url=proxy_url, info=info, country=country, time=time, ip=ip, org=org, loc=loc, X=X, Y=Y)
|
|
|
36 |
req = requests.get(f'http://{url}', stream=True, timeout=5)
|
37 |
return Response(req.iter_content(chunk_size=10*1024), content_type=req.headers['content-type'])
|
38 |
except requests.exceptions.RequestException as e:
|
39 |
+
print('retrying...')
|
40 |
retries -= 1
|
41 |
return send_file('static/error.png', mimetype='image/png')
|
42 |
|
|
|
52 |
timezone = pytz.timezone(info['timezone'])
|
53 |
time = dt.datetime.now(timezone)
|
54 |
loc = info['loc']
|
|
|
55 |
X, Y = latlon_to_pixel(info['loc'])
|
56 |
proxy_url = 'proxy/' + url.split('http://')[-1]
|
57 |
return render_template('index.html', name=name, url=proxy_url, info=info, country=country, time=time, ip=ip, org=org, loc=loc, X=X, Y=Y)
|