Skip to content

Commit

Permalink
reset default values
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiiRepair committed Aug 15, 2024
1 parent 6f302fa commit d82fa8a
Showing 1 changed file with 12 additions and 26 deletions.
38 changes: 12 additions & 26 deletions quotexpy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
import json
import pickle
import typing
import certifi
import logging
import urllib3
import platform
import requests
import threading

Expand Down Expand Up @@ -47,12 +45,6 @@
os.environ["WEBSOCKET_CLIENT_CA_BUNDLE"] = cert_path
cacert = os.environ.get("WEBSOCKET_CLIENT_CA_BUNDLE")

ssl_context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)
ssl_context.options |= ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1 | ssl.OP_NO_TLSv1_2
ssl_context.minimum_version = ssl.TLSVersion.TLSv1_3

ssl_context.load_verify_locations(certifi.where())


class QuotexAPI(object):
"""Class for communication with Quotex API"""
Expand Down Expand Up @@ -272,26 +264,20 @@ def start_websocket(self) -> bool:
self.websocket_error_reason = None
self.websocket_client = WebsocketClient(self)

payload = {
"ping_interval": 25000,
"ping_timeout": 5000,
"ping_payload": "2",
"origin": "https://qxbroker.com",
"host": "ws2.qxbroker.com",
"sslopt": {
"check_hostname": False,
"cert_reqs": ssl.CERT_NONE,
"ca_certs": cacert,
"context": ssl_context,
},
}

if platform.system() == "Linux":
payload["sslopt"]["ssl_version"] = ssl.PROTOCOL_TLS

self.websocket_thread = threading.Thread(
target=self.websocket.run_forever,
kwargs=payload,
kwargs={
"ping_interval": 25000,
"ping_timeout": 5000,
"ping_payload": "2",
"origin": "https://qxbroker.com",
"host": "ws2.qxbroker.com",
"sslopt": {
"cert_reqs": ssl.CERT_NONE,
"ca_certs": cacert,
"ssl_version": ssl.PROTOCOL_TLSv1_2,
},
},
)

self.websocket_thread.daemon = True
Expand Down

0 comments on commit d82fa8a

Please sign in to comment.