Spaces:
Runtime error
Runtime error
Commit ·
dbeac40
1
Parent(s): a3f46e0
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,12 +1,9 @@
|
|
| 1 |
import flask
|
| 2 |
from flask import request
|
| 3 |
import os
|
| 4 |
-
|
| 5 |
-
load_dotenv()
|
| 6 |
-
app = Flask(__name__)
|
| 7 |
-
|
| 8 |
@app.route('/', defaults={'path': ''})
|
| 9 |
-
@app.route('
|
| 10 |
def proxy(path):
|
| 11 |
url = 'http://адрес_целевого_сервера/' + path
|
| 12 |
headers = {'Content-Type': 'application/json'}
|
|
@@ -19,6 +16,5 @@ def proxy(path):
|
|
| 19 |
stream=True,
|
| 20 |
)
|
| 21 |
return response.content, response.status_code, response.headers.items()
|
| 22 |
-
|
| 23 |
if __name__ == '__main__':
|
| 24 |
-
app.run(host='0.0.0.0',
|
|
|
|
| 1 |
import flask
|
| 2 |
from flask import request
|
| 3 |
import os
|
| 4 |
+
app = flask.Flask(__name__)
|
|
|
|
|
|
|
|
|
|
| 5 |
@app.route('/', defaults={'path': ''})
|
| 6 |
+
@app.route('/', methods=['GET', 'POST'])
|
| 7 |
def proxy(path):
|
| 8 |
url = 'http://адрес_целевого_сервера/' + path
|
| 9 |
headers = {'Content-Type': 'application/json'}
|
|
|
|
| 16 |
stream=True,
|
| 17 |
)
|
| 18 |
return response.content, response.status_code, response.headers.items()
|
|
|
|
| 19 |
if __name__ == '__main__':
|
| 20 |
+
app.run(host='0.0.0.0', port=int(os.environ.get('PORT', 7860)))
|