Spaces:
Running
Running
BraydenMoore
commited on
Commit
•
bc53648
1
Parent(s):
7e57aa3
Update main.py
Browse files
main.py
CHANGED
@@ -69,11 +69,12 @@ def proxy(url):
|
|
69 |
|
70 |
try:
|
71 |
logging.info(f"Sending request to: {clean_url}")
|
72 |
-
req = requests.get(clean_url, headers=headers, stream=True, timeout=
|
73 |
logging.info(f"Status Code: {req.status_code}, Response Headers: {req.headers}")
|
74 |
return Response(req.iter_content(chunk_size=2048), content_type=req.headers['content-type'])
|
75 |
-
|
76 |
-
except:
|
|
|
77 |
session['exception_urls'].append(url)
|
78 |
save_exception_urls(session['exception_urls'])
|
79 |
print('Added to exceptions:',session['exception_urls'])
|
|
|
69 |
|
70 |
try:
|
71 |
logging.info(f"Sending request to: {clean_url}")
|
72 |
+
req = requests.get(clean_url, headers=headers, stream=True, timeout=10)
|
73 |
logging.info(f"Status Code: {req.status_code}, Response Headers: {req.headers}")
|
74 |
return Response(req.iter_content(chunk_size=2048), content_type=req.headers['content-type'])
|
75 |
+
|
76 |
+
except Exception as e:
|
77 |
+
logging.error(f"Error in proxy: {str(e)}")
|
78 |
session['exception_urls'].append(url)
|
79 |
save_exception_urls(session['exception_urls'])
|
80 |
print('Added to exceptions:',session['exception_urls'])
|