Antonio Cheong commited on
Commit
85dc37d
·
1 Parent(s): 867d2ff

Update requirements

Browse files
Files changed (3) hide show
  1. README.md +7 -7
  2. setup.py +1 -1
  3. src/EdgeGPT.py +12 -3
README.md CHANGED
@@ -25,8 +25,8 @@
25
  - [Setup](#setup)
26
  - [Install package](#install-package)
27
  - [Requirements](#requirements)
28
- - [Checking access (Optional)](#checking-access-optional)
29
- - [Getting authentication (Optional)](#getting-authentication-optional)
30
  - [Usage](#usage)
31
  - [Quick start](#quick-start)
32
  - [Developer demo](#developer-demo)
@@ -44,14 +44,14 @@ python3 -m pip install EdgeGPT --upgrade
44
  We have a shared token for public use. If you have your own account with access, you can use that instead.
45
 
46
  - python 3.7+
47
- - Microsoft Edge (Optional)
48
- - A Microsoft Account with early access to http://bing.com/chat (Optional)
49
 
50
 
51
  <details>
52
  <summary>
53
 
54
- ### Checking access (Optional)
55
 
56
  </summary>
57
 
@@ -65,7 +65,7 @@ We have a shared token for public use. If you have your own account with access,
65
  <details>
66
  <summary>
67
 
68
- ### Getting authentication (Optional)
69
 
70
  </summary>
71
 
@@ -99,7 +99,7 @@ usage: EdgeGPT.py [-h] [--no-stream] [--bing-cookie BING_COOKIE]
99
  options:
100
  -h, --help show this help message and exit
101
  --no-stream
102
- --bing-cookie BING_COOKIE (Optional)
103
  ```
104
 
105
  -----
 
25
  - [Setup](#setup)
26
  - [Install package](#install-package)
27
  - [Requirements](#requirements)
28
+ - [Checking access (Required)](#checking-access-required)
29
+ - [Getting authentication (Required)](#getting-authentication-required)
30
  - [Usage](#usage)
31
  - [Quick start](#quick-start)
32
  - [Developer demo](#developer-demo)
 
44
  We have a shared token for public use. If you have your own account with access, you can use that instead.
45
 
46
  - python 3.7+
47
+ - Microsoft Edge (Required)
48
+ - A Microsoft Account with early access to http://bing.com/chat (Required)
49
 
50
 
51
  <details>
52
  <summary>
53
 
54
+ ### Checking access (Required)
55
 
56
  </summary>
57
 
 
65
  <details>
66
  <summary>
67
 
68
+ ### Getting authentication (Required)
69
 
70
  </summary>
71
 
 
99
  options:
100
  -h, --help show this help message and exit
101
  --no-stream
102
+ --bing-cookie BING_COOKIE (Required)
103
  ```
104
 
105
  -----
setup.py CHANGED
@@ -3,7 +3,7 @@ from setuptools import setup
3
 
4
  setup(
5
  name="EdgeGPT",
6
- version="0.0.25",
7
  license="GNU General Public License v2.0",
8
  author="Antonio Cheong",
9
  author_email="[email protected]",
 
3
 
4
  setup(
5
  name="EdgeGPT",
6
+ version="0.0.30",
7
  license="GNU General Public License v2.0",
8
  author="Antonio Cheong",
9
  author_email="[email protected]",
src/EdgeGPT.py CHANGED
@@ -20,6 +20,7 @@ headers = {
20
  "sec-ch-ua-platform": "Windows",
21
  }
22
 
 
23
  class NotAllowedToAccess(Exception):
24
  pass
25
 
@@ -117,7 +118,11 @@ class Conversation:
117
  token = file.read()
118
  else:
119
  url = "https://images.duti.tech/allow"
120
- response = requests.post(url, timeout=10, headers=headers,)
 
 
 
 
121
  if response.status_code != 200:
122
  raise Exception("Authentication failed")
123
  token = response.json()["token"]
@@ -188,7 +193,11 @@ class ChatHub:
188
  )
189
  await self.__initial_handshake()
190
  else:
191
- self.wss = await websockets.connect("wss://sydney.bing.com/sydney/ChatHub", extra_headers=headers, max_size=None)
 
 
 
 
192
  await self.__initial_handshake()
193
  # Construct a ChatHub request
194
  self.request.update(prompt=prompt)
@@ -339,7 +348,7 @@ if __name__ == "__main__":
339
  )
340
  parser = argparse.ArgumentParser()
341
  parser.add_argument("--no-stream", action="store_true")
342
- parser.add_argument("--bing-cookie", type=str, default="")
343
  args = parser.parse_args()
344
  if args.bing_cookie:
345
  os.environ["BING_U"] = args.bing_cookie
 
20
  "sec-ch-ua-platform": "Windows",
21
  }
22
 
23
+
24
  class NotAllowedToAccess(Exception):
25
  pass
26
 
 
118
  token = file.read()
119
  else:
120
  url = "https://images.duti.tech/allow"
121
+ response = requests.post(
122
+ url,
123
+ timeout=10,
124
+ headers=headers,
125
+ )
126
  if response.status_code != 200:
127
  raise Exception("Authentication failed")
128
  token = response.json()["token"]
 
193
  )
194
  await self.__initial_handshake()
195
  else:
196
+ self.wss = await websockets.connect(
197
+ "wss://sydney.bing.com/sydney/ChatHub",
198
+ extra_headers=headers,
199
+ max_size=None,
200
+ )
201
  await self.__initial_handshake()
202
  # Construct a ChatHub request
203
  self.request.update(prompt=prompt)
 
348
  )
349
  parser = argparse.ArgumentParser()
350
  parser.add_argument("--no-stream", action="store_true")
351
+ parser.add_argument("--bing-cookie", type=str, default="", required=True)
352
  args = parser.parse_args()
353
  if args.bing_cookie:
354
  os.environ["BING_U"] = args.bing_cookie