Harry commited on
Commit
20a84cb
·
unverified ·
1 Parent(s): 6a37cab

Headers also need to change (#121)

Browse files
Files changed (1) hide show
  1. src/EdgeGPT.py +25 -3
src/EdgeGPT.py CHANGED
@@ -30,11 +30,11 @@ HEADERS = {
30
  "accept": "application/json",
31
  "accept-language": "en-US,en;q=0.9",
32
  "content-type": "application/json",
33
- "sec-ch-ua": '"Not_A Brand";v="99", "Microsoft Edge";v="109", "Chromium";v="109"',
34
  "sec-ch-ua-arch": '"x86"',
35
  "sec-ch-ua-bitness": '"64"',
36
  "sec-ch-ua-full-version": '"109.0.1518.78"',
37
- "sec-ch-ua-full-version-list": '"Not_A Brand";v="99.0.0.0", "Microsoft Edge";v="109.0.1518.78", "Chromium";v="109.0.5414.120"',
38
  "sec-ch-ua-mobile": "?0",
39
  "sec-ch-ua-model": "",
40
  "sec-ch-ua-platform": '"Windows"',
@@ -49,6 +49,28 @@ HEADERS = {
49
  "x-forwarded-for": FORWARDED_IP,
50
  }
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
 
53
  class NotAllowedToAccess(Exception):
54
  pass
@@ -178,7 +200,7 @@ class Conversation:
178
  response = self.session.get(
179
  url,
180
  timeout=30,
181
- headers=HEADERS,
182
  )
183
  if response.status_code != 200:
184
  print(f"Status code: {response.status_code}")
 
30
  "accept": "application/json",
31
  "accept-language": "en-US,en;q=0.9",
32
  "content-type": "application/json",
33
+ "sec-ch-ua": '"Not_A Brand";v="99", "Microsoft Edge";v="110", "Chromium";v="110"',
34
  "sec-ch-ua-arch": '"x86"',
35
  "sec-ch-ua-bitness": '"64"',
36
  "sec-ch-ua-full-version": '"109.0.1518.78"',
37
+ 'sec-ch-ua-full-version-list': '"Chromium";v="110.0.5481.192", "Not A(Brand";v="24.0.0.0", "Microsoft Edge";v="110.0.1587.69"',
38
  "sec-ch-ua-mobile": "?0",
39
  "sec-ch-ua-model": "",
40
  "sec-ch-ua-platform": '"Windows"',
 
49
  "x-forwarded-for": FORWARDED_IP,
50
  }
51
 
52
+ HEADERS_INIT_CONVER = {
53
+ 'authority': 'edgeservices.bing.com',
54
+ 'accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
55
+ "accept-language": "en-US,en;q=0.9",
56
+ 'cache-control': 'max-age=0',
57
+ 'sec-ch-ua': '"Chromium";v="110", "Not A(Brand";v="24", "Microsoft Edge";v="110"',
58
+ 'sec-ch-ua-arch': '"x86"',
59
+ 'sec-ch-ua-bitness': '"64"',
60
+ 'sec-ch-ua-full-version': '"110.0.1587.69"',
61
+ 'sec-ch-ua-full-version-list': '"Chromium";v="110.0.5481.192", "Not A(Brand";v="24.0.0.0", "Microsoft Edge";v="110.0.1587.69"',
62
+ 'sec-ch-ua-mobile': '?0',
63
+ 'sec-ch-ua-model': '""',
64
+ 'sec-ch-ua-platform': '"Windows"',
65
+ 'sec-ch-ua-platform-version': '"15.0.0"',
66
+ 'sec-fetch-dest': 'document',
67
+ 'sec-fetch-mode': 'navigate',
68
+ 'sec-fetch-site': 'none',
69
+ 'sec-fetch-user': '?1',
70
+ 'upgrade-insecure-requests': '1',
71
+ 'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36 Edg/110.0.1587.69',
72
+ 'x-edge-shopping-flag': '1',
73
+ }
74
 
75
  class NotAllowedToAccess(Exception):
76
  pass
 
200
  response = self.session.get(
201
  url,
202
  timeout=30,
203
+ headers=HEADERS_INIT_CONVER,
204
  )
205
  if response.status_code != 200:
206
  print(f"Status code: {response.status_code}")