Commit
·
81d7489
1
Parent(s):
f732347
Update main.py
Browse files
main.py
CHANGED
|
@@ -49,17 +49,17 @@ def proxy(url):
|
|
| 49 |
clean_url = url.replace('proxy/', '')
|
| 50 |
print('Cleaned URL:', clean_url)
|
| 51 |
|
| 52 |
-
req = requests.get(f'{clean_url}', headers=headers, stream=True, timeout=
|
| 53 |
print("Status Code:", req.status_code)
|
| 54 |
print("Response Headers:", req.headers)
|
| 55 |
|
| 56 |
content_type = req.headers['content-type']
|
| 57 |
|
| 58 |
-
return Response(req.iter_content(chunk_size=
|
| 59 |
|
| 60 |
except:
|
| 61 |
print(f'Redirecting')
|
| 62 |
-
return
|
| 63 |
|
| 64 |
|
| 65 |
@app.route('/')
|
|
|
|
| 49 |
clean_url = url.replace('proxy/', '')
|
| 50 |
print('Cleaned URL:', clean_url)
|
| 51 |
|
| 52 |
+
req = requests.get(f'{clean_url}', headers=headers, stream=True, timeout=15)
|
| 53 |
print("Status Code:", req.status_code)
|
| 54 |
print("Response Headers:", req.headers)
|
| 55 |
|
| 56 |
content_type = req.headers['content-type']
|
| 57 |
|
| 58 |
+
return Response(req.iter_content(chunk_size=2*1024), content_type=content_type)
|
| 59 |
|
| 60 |
except:
|
| 61 |
print(f'Redirecting')
|
| 62 |
+
return send_file('static/error.png', mimetype='image/png')
|
| 63 |
|
| 64 |
|
| 65 |
@app.route('/')
|