Skip to content

Commit

Permalink
removed proxy feature due cloudflare sucks
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiiRepair committed Jan 7, 2024
1 parent 52f9861 commit db70917
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 23 deletions.
6 changes: 5 additions & 1 deletion example/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,11 @@ def __x__(y):
return z


client = Quotex(email="[email protected]", password="password")
client = Quotex(
email="[email protected]",
password="password",
)

client.debug_ws_enable = False


Expand Down
11 changes: 6 additions & 5 deletions quotexpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import math
import asyncio
import logging
from typing import Union, Dict
from collections import defaultdict
from datetime import datetime, timedelta

Expand All @@ -28,12 +27,10 @@ def truncate(f, n):
class Quotex(object):
__version__ = "1.40.3"

def __init__(self, email, password, proxy: Union[Dict, None]=None):

def __init__(self, email, password):
self.api = None
self.email = email
self.password = password
self.proxy = proxy
self.set_ssid = None
self.duration = None
self.suspend = 0.5
Expand Down Expand Up @@ -134,7 +131,11 @@ async def get_candle_v2(self, asset, period, size=10):
async def connect(self):
if global_value.check_websocket_if_connect:
self.close()
self.api = QuotexAPI("qxbroker.com", self.email, self.password, self.proxy)
self.api = QuotexAPI(
"qxbroker.com",
self.email,
self.password,
)
self.api.trace_ws = self.debug_ws_enable
check, reason = await self.api.connect()
if check:
Expand Down
8 changes: 1 addition & 7 deletions quotexpy/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class QuotexAPI(object):
timesync = TimeSync()
candles = Candles()

def __init__(self, host, email, password, proxy=None):
def __init__(self, host, email, password):
"""
:param str host: The hostname or ip address of a Quotex server.
:param str email: The email of a Quotex server.
Expand All @@ -67,12 +67,6 @@ def __init__(self, host, email, password, proxy=None):
"""
self.email = email
self.password = password

if proxy is not None and proxy is not "":
if urlparse(proxy).scheme == "":
raise ValueError("Proxy URL does not specify a supported protocol.")

self.proxy = proxy
self._temp_status = ""
self.settings_list = {}
self.signal_data = nested_dict(2, dict)
Expand Down
4 changes: 1 addition & 3 deletions quotexpy/http/login.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
from typing import Union, Dict
from quotexpy.http.qxbroker import Browser


Expand All @@ -11,7 +10,7 @@ class Login(Browser):
base_url = "qxbroker.com"
https_base_url = f"https://{base_url}"

async def __call__(self, email, password, proxy: Union[Dict, None]=None):
async def __call__(self, email, password):
"""
Method to get Quotex API login http request.
:param str username: The username of a Quotex server.
Expand All @@ -21,7 +20,6 @@ async def __call__(self, email, password, proxy: Union[Dict, None]=None):

self.email = email
self.password = password
self.proxy = proxy

self.ssid, self.cookies = await self.get_cookies_and_ssid()
return self.ssid, self.cookies
4 changes: 0 additions & 4 deletions quotexpy/http/navigator.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import random
import requests
from bs4 import BeautifulSoup
from urllib.parse import urlparse
from urllib3.util.retry import Retry
from requests.adapters import HTTPAdapter

Expand Down Expand Up @@ -31,9 +30,6 @@ def __init__(self, api):
self.session.mount("http://", adapter)
self.session.mount("https://", adapter)

if self.api.proxy:
self.session.proxies.update({urlparse(self.api.proxy).scheme: self.api.proxy["server"]})

def get_headers(self):
self.headers = {
"User-Agent": user_agent_list[random.randint(0, len(user_agent_list) - 1)],
Expand Down
4 changes: 1 addition & 3 deletions quotexpy/http/qxbroker.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,11 @@ class Browser(object):
base_url = "qxbroker.com"
https_base_url = f"https://{base_url}"

proxy = None

def __init__(self, api):
self.api = api

async def run(self, playwright: Playwright) -> Tuple[Any, str]:
browser = await playwright.firefox.launch(headless=True, proxy=self.proxy)
browser = await playwright.firefox.launch(headless=True)
context = await browser.new_context()
page = await context.new_page()

Expand Down

0 comments on commit db70917

Please sign in to comment.