Commit
·
3fce1e8
1
Parent(s):
0d7ea83
Update main.py
Browse files
main.py
CHANGED
|
@@ -70,13 +70,13 @@ def proxy(url):
|
|
| 70 |
|
| 71 |
try:
|
| 72 |
if '.jpg' in clean_url and 'stream' not in clean_url:
|
| 73 |
-
req = requests.get(clean_url, headers=headers, timeout=
|
| 74 |
logging.info(f"Status Code: {req.status_code}, Response Headers: {req.headers}")
|
| 75 |
return Response(req.content, content_type=req.headers['content-type'])
|
| 76 |
else:
|
| 77 |
-
req = requests.get(clean_url, headers=headers, stream=True, timeout=
|
| 78 |
logging.info(f"Status Code: {req.status_code}, Response Headers: {req.headers}")
|
| 79 |
-
return Response(req.iter_content(chunk_size=
|
| 80 |
except:
|
| 81 |
session['exception_urls'].append(url)
|
| 82 |
save_exception_urls(session['exception_urls'])
|
|
|
|
| 70 |
|
| 71 |
try:
|
| 72 |
if '.jpg' in clean_url and 'stream' not in clean_url:
|
| 73 |
+
req = requests.get(clean_url, headers=headers, timeout=10)
|
| 74 |
logging.info(f"Status Code: {req.status_code}, Response Headers: {req.headers}")
|
| 75 |
return Response(req.content, content_type=req.headers['content-type'])
|
| 76 |
else:
|
| 77 |
+
req = requests.get(clean_url, headers=headers, stream=True, timeout=15)
|
| 78 |
logging.info(f"Status Code: {req.status_code}, Response Headers: {req.headers}")
|
| 79 |
+
return Response(req.iter_content(chunk_size=2048), content_type=req.headers['content-type'])
|
| 80 |
except:
|
| 81 |
session['exception_urls'].append(url)
|
| 82 |
save_exception_urls(session['exception_urls'])
|