Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ZSPASOV committed Jun 24, 2024
1 parent dfb8c61 commit 6d9a616
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions samples/python/app.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import http
import http.client
import os
import random

Expand Down Expand Up @@ -27,6 +29,15 @@ def new_app():
client_reg = RegistrationResponse(**info)

client.store_registration_info(client_reg)
proxy_host = os.environ.get("PROXY_HOST")
proxy_port = os.environ.get("PROXY_PORT")

if proxy_host is not None and proxy_port is not None:
connection = http.client.HTTPSConnection(proxy_host, int(proxy_port))
connection.set_tunnel("http://localhost", 8000)
connection.connect()
print(f"\n\nCONNECTION HOST: {connection.host}\n\n")
print(f"\n\nCONNECTION port: {connection.port}\n\n")

return app, client

Expand Down Expand Up @@ -81,10 +92,10 @@ def login():

return Redirect(f"/?session={session_id}")

proxy_host = os.environ.get("PROXY_HOST")
proxy_port = os.environ.get("PROXY_PORT")
# proxy_host = os.environ.get("PROXY_HOST")
# proxy_port = os.environ.get("PROXY_PORT")

if __name__ == "__main__" and proxy_host is not None and proxy_port is not None:
app.run(host=proxy_host, port=proxy_port, debug=True)
elif __name__ == "__main__":
# if __name__ == "__main__" and proxy_host is not None and proxy_port is not None:
# app.run(host=proxy_host, port=proxy_port, debug=True)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000, debug=True)

0 comments on commit 6d9a616

Please sign in to comment.