Hansimov commited on
Commit
a1801ab
1 Parent(s): 4c9b469

:zap: [Enhance] Fix 404 when create with setting x-forwarded-for to US IP

Browse files
conversations/conversation_creator.py CHANGED
@@ -16,10 +16,19 @@ class ConversationCreator:
16
  for key, val in self.cookies.items():
17
  self.httpx_cookies.set(key, val)
18
 
 
 
 
 
 
 
 
19
  def create(self, proxy: str = None):
20
  self.construct_cookies()
 
21
  self.response = httpx.get(
22
  self.conversation_create_url,
 
23
  proxies=http_proxy if proxy is None else proxy,
24
  cookies=self.httpx_cookies,
25
  )
 
16
  for key, val in self.cookies.items():
17
  self.httpx_cookies.set(key, val)
18
 
19
+ def construct_headers(self):
20
+ # New Bing 封锁原理探讨 #78
21
+ # https://github.com/weaigc/bingo/issues/78
22
+ self.request_headers = {
23
+ "X-Forwarded-For": "65.49.22.66",
24
+ }
25
+
26
  def create(self, proxy: str = None):
27
  self.construct_cookies()
28
+ self.construct_headers()
29
  self.response = httpx.get(
30
  self.conversation_create_url,
31
+ headers=self.request_headers,
32
  proxies=http_proxy if proxy is None else proxy,
33
  cookies=self.httpx_cookies,
34
  )