Skip to content

Commit

Permalink
💥 [Fix] Default proxies in creator and connector
Browse files Browse the repository at this point in the history
  • Loading branch information
Hansimov committed Dec 7, 2023
1 parent 3e80069 commit 1f691c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions conversations/conversation_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
from utils.logger import logger
from utils.enver import enver

enver.set_envs(proxies=True)


class ConversationConnector:
"""
Expand Down Expand Up @@ -59,10 +57,11 @@ async def connect(self):
)
self.aiohttp_session = aiohttp.ClientSession(cookies=self.cookies)
headers_constructor = ConversationRequestHeadersConstructor()
enver.set_envs(proxies=True)
self.wss = await self.aiohttp_session.ws_connect(
self.ws_url,
headers=headers_constructor.request_headers,
proxy=enver.envs["http_proxy"],
proxy=enver.envs.get("http_proxy") or None,
)
await self.init_handshake()

Expand Down
5 changes: 2 additions & 3 deletions conversations/conversation_creator.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
from pprint import pprint
from utils.enver import enver

enver.set_envs(proxies=True)


class ConversationCreator:
conversation_create_url = "https://www.bing.com/turing/conversation/create"
Expand All @@ -27,10 +25,11 @@ def construct_headers(self):
def create(self):
self.construct_cookies()
self.construct_headers()
enver.set_envs(proxies=True)
self.response = httpx.get(
self.conversation_create_url,
headers=self.request_headers,
proxies=enver.envs["http_proxy"],
proxies=enver.envs.get("http_proxy") or None,
cookies=self.httpx_cookies,
)
self.response_content = json.loads(self.response.content.decode("utf-8"))
Expand Down

0 comments on commit 1f691c1

Please sign in to comment.