Update app.py
Browse files
app.py
CHANGED
@@ -28,16 +28,16 @@ def proxy():
|
|
28 |
data=data,
|
29 |
allow_redirects=False
|
30 |
)
|
31 |
-
|
32 |
if 'text/html' in response.headers.get('content-type', ''):
|
33 |
soup = BeautifulSoup(response.content, 'html.parser')
|
34 |
for tag in soup.find_all(href=True):
|
35 |
tag['href'] = '/proxy?url=' + tag['href']
|
36 |
for tag in soup.find_all(src=True):
|
37 |
tag['src'] = '/proxy?url=' + tag['src']
|
38 |
-
|
39 |
|
40 |
-
return
|
41 |
except requests.RequestException as e:
|
42 |
return jsonify({'error': str(e)}), 500
|
43 |
|
|
|
28 |
data=data,
|
29 |
allow_redirects=False
|
30 |
)
|
31 |
+
content = response.content
|
32 |
if 'text/html' in response.headers.get('content-type', ''):
|
33 |
soup = BeautifulSoup(response.content, 'html.parser')
|
34 |
for tag in soup.find_all(href=True):
|
35 |
tag['href'] = '/proxy?url=' + tag['href']
|
36 |
for tag in soup.find_all(src=True):
|
37 |
tag['src'] = '/proxy?url=' + tag['src']
|
38 |
+
content = soup.encode()
|
39 |
|
40 |
+
return content, response.status_code, response.headers.items()
|
41 |
except requests.RequestException as e:
|
42 |
return jsonify({'error': str(e)}), 500
|
43 |
|