This repository has been archived by the owner on Dec 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 256
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
36 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,6 +8,8 @@ An unofficial Python wrapper for OpenAI's ChatGPT API | |
|
||
## Getting Started | ||
|
||
> On 2022/12/11, OpenAI has implemented Cloudflare's anti-bot protection on the ChatGPT API. This wrapper is now using `undetected_chromedriver` to bypass the protection. **Please make sure you have [Google Chrome](https://www.google.com/chrome/) before using this wrapper.** Authorization using login credentials is removed due to the consistent captcha requirement on the login page. | ||
### Installation | ||
|
||
```bash | ||
|
@@ -37,13 +39,13 @@ from pyChatGPT import ChatGPT | |
|
||
session_token = 'abc123' # `__Secure-next-auth.session-token` cookie from https://chat.openai.com/chat | ||
api = ChatGPT(session_token) # auth with session token | ||
api2 = ChatGPT(email='[email protected]', password='password') # auth with email and password | ||
api3 = ChatGPT(session_token, conversation_id='some-random-uuid', parent_id='another-random-uuid') # specify a conversation | ||
api4 = ChatGPT(session_token, proxy='http://proxy.example.com:8080') # specify proxy | ||
api2 = ChatGPT(session_token, conversation_id='some-random-uuid', parent_id='another-random-uuid') # specify a conversation | ||
api3 = ChatGPT(session_token, proxy='http://proxy.example.com:8080') # specify proxy | ||
|
||
resp = api.send_message('Hello, world!') | ||
print(resp['message']) | ||
|
||
api.refresh_cookies() # refresh the cookies (if cloudflare bypass is not working | ||
api.refresh_auth() # refresh the authorization token | ||
api.reset_conversation() # reset the conversation | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" | |
|
||
[project] | ||
name = "pyChatGPT" | ||
version = "0.1.2" | ||
version = "0.2.0" | ||
authors = [ | ||
{ name="terry3041", email="[email protected]" }, | ||
] | ||
|
@@ -17,6 +17,7 @@ classifiers = [ | |
"Operating System :: OS Independent", | ||
] | ||
dependencies = [ | ||
'undetected-chromedriver >= 3.1.7', | ||
'requests', | ||
'uuid', | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters