Spaces:
Running
Running
Commit
·
2af4039
1
Parent(s):
a45efa4
Update main.py
Browse files
main.py
CHANGED
@@ -33,18 +33,14 @@ def latlon_to_pixel(loc):
|
|
33 |
|
34 |
from urllib.parse import urlparse, parse_qs
|
35 |
|
36 |
-
@app.route('/proxy/<
|
37 |
def proxy(url):
|
38 |
-
|
39 |
-
parsed_url = urlparse(full_url)
|
40 |
-
query_params = parse_qs(parsed_url.query)
|
41 |
-
|
42 |
headers = {'User-Agent': 'Mozilla/5.0'}
|
43 |
try:
|
44 |
-
req = requests.get(f'http://{
|
45 |
-
params=query_params, headers=headers, stream=True, timeout=20)
|
46 |
-
|
47 |
content_type = req.headers['content-type']
|
|
|
48 |
return Response(req.iter_content(chunk_size=10*1024), content_type=content_type)
|
49 |
|
50 |
except requests.exceptions.RequestException as e:
|
|
|
33 |
|
34 |
from urllib.parse import urlparse, parse_qs
|
35 |
|
36 |
+
@app.route('/proxy/<path:url>')
|
37 |
def proxy(url):
|
38 |
+
print('URL:', url)
|
|
|
|
|
|
|
39 |
headers = {'User-Agent': 'Mozilla/5.0'}
|
40 |
try:
|
41 |
+
req = requests.get(f'http://{url}', headers=headers, stream=True, timeout=15)
|
|
|
|
|
42 |
content_type = req.headers['content-type']
|
43 |
+
|
44 |
return Response(req.iter_content(chunk_size=10*1024), content_type=content_type)
|
45 |
|
46 |
except requests.exceptions.RequestException as e:
|