Hansimov commited on
Commit
1f691c1
1 Parent(s): 3e80069

:boom: [Fix] Default proxies in creator and connector

Browse files
conversations/conversation_connector.py CHANGED
@@ -11,8 +11,6 @@ from networks import (
11
  from utils.logger import logger
12
  from utils.enver import enver
13
 
14
- enver.set_envs(proxies=True)
15
-
16
 
17
  class ConversationConnector:
18
  """
@@ -59,10 +57,11 @@ class ConversationConnector:
59
  )
60
  self.aiohttp_session = aiohttp.ClientSession(cookies=self.cookies)
61
  headers_constructor = ConversationRequestHeadersConstructor()
 
62
  self.wss = await self.aiohttp_session.ws_connect(
63
  self.ws_url,
64
  headers=headers_constructor.request_headers,
65
- proxy=enver.envs["http_proxy"],
66
  )
67
  await self.init_handshake()
68
 
 
11
  from utils.logger import logger
12
  from utils.enver import enver
13
 
 
 
14
 
15
  class ConversationConnector:
16
  """
 
57
  )
58
  self.aiohttp_session = aiohttp.ClientSession(cookies=self.cookies)
59
  headers_constructor = ConversationRequestHeadersConstructor()
60
+ enver.set_envs(proxies=True)
61
  self.wss = await self.aiohttp_session.ws_connect(
62
  self.ws_url,
63
  headers=headers_constructor.request_headers,
64
+ proxy=enver.envs.get("http_proxy") or None,
65
  )
66
  await self.init_handshake()
67
 
conversations/conversation_creator.py CHANGED
@@ -3,8 +3,6 @@ import json
3
  from pprint import pprint
4
  from utils.enver import enver
5
 
6
- enver.set_envs(proxies=True)
7
-
8
 
9
  class ConversationCreator:
10
  conversation_create_url = "https://www.bing.com/turing/conversation/create"
@@ -27,10 +25,11 @@ class ConversationCreator:
27
  def create(self):
28
  self.construct_cookies()
29
  self.construct_headers()
 
30
  self.response = httpx.get(
31
  self.conversation_create_url,
32
  headers=self.request_headers,
33
- proxies=enver.envs["http_proxy"],
34
  cookies=self.httpx_cookies,
35
  )
36
  self.response_content = json.loads(self.response.content.decode("utf-8"))
 
3
  from pprint import pprint
4
  from utils.enver import enver
5
 
 
 
6
 
7
  class ConversationCreator:
8
  conversation_create_url = "https://www.bing.com/turing/conversation/create"
 
25
  def create(self):
26
  self.construct_cookies()
27
  self.construct_headers()
28
+ enver.set_envs(proxies=True)
29
  self.response = httpx.get(
30
  self.conversation_create_url,
31
  headers=self.request_headers,
32
+ proxies=enver.envs.get("http_proxy") or None,
33
  cookies=self.httpx_cookies,
34
  )
35
  self.response_content = json.loads(self.response.content.decode("utf-8"))