Hansimov commited on
Commit
dcbfe03
1 Parent(s): 3eecc54

:zap: [Enhance] Set proxy in enver for easier use

Browse files
conversations/conversation_connector.py CHANGED
@@ -61,7 +61,7 @@ class ConversationConnector:
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
 
 
61
  self.wss = await self.aiohttp_session.ws_connect(
62
  self.ws_url,
63
  headers=headers_constructor.request_headers,
64
+ proxy=enver.proxy,
65
  )
66
  await self.init_handshake()
67
 
conversations/conversation_creator.py CHANGED
@@ -29,7 +29,7 @@ class ConversationCreator:
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
  try:
 
29
  self.response = httpx.get(
30
  self.conversation_create_url,
31
  headers=self.request_headers,
32
+ proxies=enver.proxy,
33
  cookies=self.httpx_cookies,
34
  )
35
  try:
utils/enver.py CHANGED
@@ -42,9 +42,14 @@ class OSEnver:
42
  self.envs[proxy_env] = os.getenv("http_proxy")
43
  else:
44
  continue
45
- print(f"Set {proxy_env} to {self.envs[proxy_env]}")
46
- else:
47
- pass
 
 
 
 
 
48
 
49
 
50
  enver = OSEnver()
 
42
  self.envs[proxy_env] = os.getenv("http_proxy")
43
  else:
44
  continue
45
+ print(f"Set {proxy_env} to {self.envs.get(proxy_env)}")
46
+
47
+ self.proxy = (
48
+ self.envs.get("all_proxy")
49
+ or self.envs.get("http_proxy")
50
+ or self.envs.get("https_proxy")
51
+ or None
52
+ )
53
 
54
 
55
  enver = OSEnver()