I have a client server application. I managed to make them connect over https using SSl encryption using this
context = SSL.Context(SSL.SSLv3_METHOD)
con
I've ran into trouble with this also. I originally had:
if sys.argv[1] == 'https' or sys.argv[1] == 'Https':
app.run(host="0.0.0.0", port=12100, ssl_context='adhoc')
elif sys.argv[1] == 'http' or sys.argv[1] == 'HTTP':
app.run(host="0.0.0.0", port=12100)
which only allowed either http or https at a time and not both.
So I used multi-threading to make both work at the same time. I put each app.run in it's own function and called an independent thread on each one of them.
import threading
import time as t
...
def runHttps():
app.run(host="0.0.0.0", port=12101, ssl_context='adhoc')
def runHttp():
app.run(host="0.0.0.0", port=12100)
if __name__ == '__main__':
# register_views(app)
CORS(app, resources={r"*": {"origins": "*"}}, supports_credentials=True)
if sys.argv[1] == 'https' or sys.argv[1] == 'Https' or sys.argv[1] == 'http' or sys.argv[1] == 'Http':
print("here")
y = threading.Thread(target=runHttp)
x = threading.Thread(target=runHttps)
print("before running runHttps and runHttp")
y.start()
t.sleep(0.5)
x.start()
And that's how I made http and https work at the same time.