Giter Site home page Giter Site logo

rawandahmad698 / pychatgpt Goto Github PK

View Code? Open in Web Editor NEW
4.2K 97.0 449.0 104 KB

⚡️ Python client for the unofficial ChatGPT API with auto token regeneration, conversation tracking, proxy support and more.

License: MIT License

Python 100.00%
chatgpt openai python

pychatgpt's Introduction

Discord Discussion Current State: Not maintained. Not Working.

Sorry guys! Really busy with private projects. This was very fun!

🔥 PyChatGPT

Read More - How OpenAI filters requests made by bots/scrapers

Python PyPi PyPi

⭐️ Like this repo? please star & consider donating to keep it maintained

Buy Me A Coffee

💡 If OpenAI change their API, I will fix it as soon as possible, so Watch the repo if you want to be notified

Features

  • Save Conversations to a file
  • Resume conversations even after closing the program
  • Proxy Support
  • Automatically login without involving a browser
  • Automatically grab Access Token
  • Get around the login captcha (If you try to log in subsequently, you will be prompted to solve a captcha)
  • Saves the access token to a file, so you don't have to log in again
  • Automatically refreshes the access token when it expires
  • Uses colorama to colorize the output, because why not?
  • Smart Conversation Tracking

Web Demo

Integrated into Huggingface Spaces 🤗 using Gradio. Try out the Web Demo

Hugging Face Spaces

Chatting

Screenshot 1

Creating a token

Screenshot 2

You: Hi there, My name is Rawa
Chat GPT: Hello Rawa, nice to meet you. Is there something you would like to talk about or ask me? I'm here to help with any questions you may have.
You: great, now say my name like Heisenberg
Chat GPT: Sure, Rawa like Heisenberg. Is there anything else you would like to talk about? I'm here to help with any questions you may have.
You: Sorry I meant like the episode of Breaking Bad where Walter White says Heisenberg
Chat GPT: Ah, I see. In that case, you could try saying it like this: "My name is Rawa, like Heisenberg." This is a reference to the character Walter White from the TV show Breaking Bad, who often used the pseudonym "Heisenberg" when conducting illegal activities. The character was known for his cool and calculated demeanor, so saying your name like Heisenberg in this context would mean saying it with confidence and authority.

Install

pip install chatgptpy --upgrade

Usage

[NEW] Pass a options() object to the ChatGPT() constructor to customize the session

[NEW] You can now save your conversations to a file

from pychatgpt import Chat, Options

options = Options()

# [New] Pass Moderation. https://github.com/rawandahmad698/PyChatGPT/discussions/103
# options.pass_moderation = False

# [New] Enable, Disable logs
options.log = True

# Track conversation
options.track = True 

# Use a proxy
options.proxies = 'http://localhost:8080'

# Optionally, you can pass a file path to save the conversation
# They're created if they don't exist

# options.chat_log = "chat_log.txt"
# options.id_log = "id_log.txt"

# Create a Chat object
chat = Chat(email="email", password="password", options=options)
answer = chat.ask("How are you?")
print(answer)

[NEW] Resume a conversation

from pychatgpt import Chat

# Create a Chat object
chat = Chat(email="email", password="password", 
            conversation_id="Parent Conversation ID", 
            previous_convo_id="Previous Conversation ID")

answer, parent_conversation_id, conversation_id = chat.ask("How are you?")

print(answer)

# Or change the conversation id later
answer, _, _ = chat.ask("How are you?", 
                        previous_convo_id="Parent Conversation ID",
                        conversation_id="Previous Conversation ID")
print(answer)

Start a CLI Session

from pychatgpt import Chat

chat = Chat(email="email", password="password")
chat.cli_chat()

Ask a one time question

from pychatgpt import Chat

# Initializing the chat class will automatically log you in, check access_tokens
chat = Chat(email="email", password="password") 
answer, parent_conversation_id, conversation_id = chat.ask("Hello!")

You could also manually set, get the token

import time
from pychatgpt import OpenAI

# Manually set the token
OpenAI.Auth(email_address="email", password="password").save_access_token(access_token="", expiry=time.time() + 3600)

# Get the token, expiry
access_token, expiry = OpenAI.get_access_token()

# Check if the token is valid
is_expired = OpenAI.token_expired() # Returns True or False
Change Log

Update using pip install chatgptpy --upgrade

1.0.8

  • Fixes an issue when reading from id_log.txt
  • Introduces a new pass_moderation parameter to the options() class, defaults to False
  • Adds proxies to moderation.
  • If pass_moderation is True, the function is invoked in another thread, so it doesn't block the main thread.

1.0.7

  • Make a request to the mod endpoint first, otherwise a crippled version of the response is returned

1.0.6

  • New option to turn off logs.
  • Better Error handling.
  • Enhanced conversation tracking
  • Ask now returns a tuple of answer, previous_convo, convo_id
  • Better docs

1.0.5

  • Pull requests/minor fixes

1.0.4

  • Fixes for part 8 of token authentication

1.0.3

  • a new options() class method to set the options for the chat session
  • save the conversation to a file
  • resume the conversation even after closing the program

1.0.2

  • ChatGPT API switches from action=next to action=variant, frequently. This library is now using action=variant instead of action=next to get the next response from the API.
  • Sometimes when the server is overloaded, the API returns a 502 Bad Gateway error.
  • Added Error handling if the auth.json file is not found/corrupt

1.0.0

  • Initial Release via PyPi

Other notes

If the token creation process is failing:

  1. Try to use a proxy (I recommend using this always)
  2. Don't try to log in too fast. At least wait 10 minutes if you're being rate limited.
  3. If you're still having issues, try to use a VPN. On a VPN, the script should work fine.

What's next?

I'm planning to add a few more features, such as:

  • A python module that can be imported and used in other projects
  • A way to save the conversation
  • Better error handling
  • Multi-user chatting

The whole process

I have been looking for a way to interact with the new Chat GPT API, but most of the sources here on GitHub require you to have a Chromium instance running in the background. or by using the Web Inspector to grab Access Token manually.

No more. I have been able to reverse engineer the API and use a TLS client to mimic a real user, allowing the script to login without setting off any bot detection techniques by Auth0

Basically, the script logs in on your behalf, using a TLS client, then grabs the Access Token. It's pretty fast.

First, I'd like to tell you that "just making http" requests is not going to be enough, Auth0 is smart, each process is guarded by a state token, which is a JWT token. This token is used to prevent CSRF attacks, and it's also used to prevent bots from logging in. If you look at the auth.py file, there are over nine functions, each one of them is responsible for a different task, and they all work together to create a token for you. allow-redirects played a huge role in this, as it allowed to navigate through the login process

I work at MeshMonitors.io, We make amazing tools (Check it out yo!). I decided not to spend too much time on this, but here we are.

Why did I do this?

No one has been able to do this, and I wanted to see if I could.

Credits

pychatgpt's People

Contributors

ak391 avatar alx avatar casey avatar eltociear avatar hackinghackers avatar mazawrath avatar mjpost avatar nithselv avatar rawandahmad698 avatar waxsd100 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pychatgpt's Issues

Cloud environments fail to install v1

Heya.

Trying to deploy on Railway, which seems to use Nix. But putting aside that, it fails to find the v1 versions.

This is the end of the logs. I have chatgptpy>=1.0.0 in requirements.txt.

#11 7.244      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 195.4/195.4 KB 19.3 MB/s eta 0:00:00
#11 7.271 ERROR: Could not find a version that satisfies the requirement chatgptpy>=1.0.0 (from versions: none)
#11 7.271 ERROR: No matching distribution found for chatgptpy>=1.0.0
 
#11 7.454 WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
#11 7.454 You should consider upgrading via the '/opt/venv/bin/python -m pip install --upgrade pip' command.
 
#11 ERROR: executor failed running [/bin/bash -ol pipefail -c python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt]: exit code: 1
 
-----
> [stage-0 7/8] RUN --mount=type=cache,id=s/e7f0188c-eb7a-4375-928c-93a5db1b154e-/root/cache/pip,target=/root/.cache/pip python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt:
-----
executor failed running [/bin/bash -ol pipefail -c python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt]: exit code: 1
 
Error: Docker build failed

Ideas?

tls_client.exceptions

image

Thanks a lot for previous question!!!, but now I get another issus when i use a proxy for this service.

Service unavailable

I'm getting this error at the moment, accessing from the web UI is still working fine.

Error: <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta content='text/html; charset=utf-8' http-equiv='content-type'/><style type='text/css'>body 
{font-family:Arial; margin-left:40px; }img  { border:0 none; }#content { margin-left: auto; margin-right: auto }#message h2 { font-size: 20px; font-weight: normal; color: #000000; margin: 34px 0px 0px 0px }#message p  { font-size: 13px; color: #000000; margin: 7px 0px 0px0px}#errorref { font-size: 11px; color: #737373; margin-top: 41px }</style>
<title>Service unavailable</title></head><body><div id='content'><div id='message'><h2>Our services aren't available right now</h2><p>We're working to restore all services as soon as possible. Please check back soon.</p>
</div><div id='errorref'><span>0EUeQYwAAAACS3Cg/hnmVQosuObsYhGBFU1lEMDNFREdFMTIxNwBlNjZiOGIwMy0wNzkzLTQ0MDktOTc3My0yZTYxMmU3MWExZTM=</span></div></div></body></html>

Incorrect API key provided

When I use “chat.ask()” to get an answer, what I got is

[Status Code] 401 | [Response Text] {"detail":{"message":"Incorrect API key provided: Bearer. You can find your API key at https://beta.openai.com.","type":"invalid_request_error","param":null,"code":"invalid_api_key"}

image

image

Incorrect API Key Provided: Bearer

Testing with cli_chat() I get the following result:

>> Access token is valid.
>> Starting CLI chat session...
You: Hello!
Chat GPT is typing... |#----|Error: {"detail":{"message":"Incorrect API key provided: Bearer. You can find your API key at https://beta.openai.com.","type":"invalid_request_error","param":null,"code":"invalid_api_key"}}
>> Failed to get a response from the API.

Login seems to go smoothly otherwise. OpenAI does provide an account-level API key but I'm assuming that it's not necessary here (?)

Cloud env fail to download v1 and v1.0.1

Heya.

Trying to deploy on Railway, which seems to use Nix. But putting aside that, it fails to find the v1 versions.

This is the end of the logs. I have chatgptpy>=1.0.0 in requirements.txt.

#11 7.244      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 195.4/195.4 KB 19.3 MB/s eta 0:00:00
#11 7.271 ERROR: Could not find a version that satisfies the requirement chatgptpy>=1.0.0 (from versions: none)
#11 7.271 ERROR: No matching distribution found for chatgptpy>=1.0.0
 
#11 7.454 WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
#11 7.454 You should consider upgrading via the '/opt/venv/bin/python -m pip install --upgrade pip' command.
 
#11 ERROR: executor failed running [/bin/bash -ol pipefail -c python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt]: exit code: 1
 
-----
> [stage-0 7/8] RUN --mount=type=cache,id=s/e7f0188c-eb7a-4375-928c-93a5db1b154e-/root/cache/pip,target=/root/.cache/pip python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt:
-----
executor failed running [/bin/bash -ol pipefail -c python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt]: exit code: 1
 
Error: Docker build failed

Ideas?

Persistent conversation in chat function

I saw a pull request for persistent conversations which seems to work in the CLI function, can this also be enabled for the Chat function for bots that poll chat.ask and exit?

OpenAI is blocking bots

[OpenAI][8] Saved access token
>> Successfully refreshed credentials.
>> Starting chat...
You: Greetings.
Error: <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'><html xmlns='http://www.w3.org/1999/xhtml'><head><meta content='text/html; charset=utf-8' http-equiv='content-type'/><style type='text/css'>body { font-family:Arial; margin-left:40px; }img  { border:0 none; }#content { margin-left: auto; margin-right: auto }#message h2 { font-size: 20px; font-weight: normal; color: #000000; margin: 34px 0px 0px 0px }#message p  { font-size: 13px; color: #000000; margin: 7px 0px 0px 0px }#errorref { font-size: 11px; color: #737373; margin-top: 41px }</style><title>Microsoft</title></head><body><div id='content'><div id='message'><h2>The request is blocked.</h2></div><div id='errorref'><span>0Ic2OYwAAAAAHzxh3k6B8R5edhEN/cT08V1NURURHRTAxMDYAZTY2YjhiMDMtMDc5My00NDA5LTk3NzMtMmU2MTJlNzFhMWUz</span></div></div></body></html>
Chat GPT: Error
You:

https://twitter.com/altryne/status/1599915270721572864

altryne/chatGPT-telegram-bot@7cf278f

When I set the output file name for chat_log.txt, it is not output correctly

When chat_log.txt is output with the following code
chat_log.txt contains the contents that should have been output in id_log.txt.

The file id_log.txt was not created.

from pychatgpt import Chat, Options

options = Options()

options.track = True
options.chat_log = "chat_log.txt"
options.id_log = "id_log.txt"

chat: Chat = Chat(email="######", password="######", options=options)


def main():
    answer = chat.ask("Hello World")
    # Two files, chat_log.txt and id_log.txt, should be generated, but actually only chat_log.txt is generated.
    # And in chat_log.txt, the contents that should be output in id_log.txt are output.
    chat.save_data()
    print(answer)
    pass


if __name__ == "__main__":
    main()

image

Can you publish it to pypi?

Thanks for your great work. I am trying to use this SDK in my project, but it seems that it can only be installed through Git clone, so have you considered the publish it to pypi?

raise Exceptions.Auth0Exception("[OpenAI][8] While most of the process was successful, " pychatgpt.classes.exceptions.Auth0Exception: [OpenAI][8] While most of the process was successful, Auth0 didn't issue an access token, Use proxies or retry.

After input captcha, it gives error:

raise Exceptions.Auth0Exception("[OpenAI][8] While most of the process was successful, "

pychatgpt.classes.exceptions.Auth0Exception: [OpenAI][8] While most of the process was successful, Auth0 didn't issue an access token, Use proxies or retry.

Can't pass previous_convo_id to Chat

I would like to be able to decide whether the context of the previous messages are kept, so when I run chat.ask() I would like to be able to pass the variable found on line 22, previous_convo_id.
However, when I try to pass it along with the prompt I get the error discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: ask() got an unexpected keyword argument 'previous_convo_id'.
Is this variable somehow private? Pardon my lack of experience with Python but I'm not sure why I would have access to prompt but not any of the other variables.

Not correct format?

<style type='text/css'>body { font-family:Arial; margin-left:40px; }img { border:0 none; }#content { margin-left: auto; margin-right: auto }#message h2 { font-size: 20px; font-weight: normal; color: #000000; margin: 34px 0px 0px 0px }#message p { font-size: 13px; color: #000000; margin: 7px 0px 0px 0px }#errorref { font-size: 11px; color: #737373; margin-top: 41px }</style><title>Microsoft</title>

The request is blocked.

02hyPYwAAAACxYmXnQasRQKOGVV7o7csGRlJBMjMxMDUwNDE4MDM3AGU2NmI4YjAzLTA3OTMtNDQwOS05NzczLTJlNjEyZTcxYTFlMw==

This is the answer I get when I sent something to it in the logs.

Conversation Resume

Is there any way to resume a conversation so the context it had from before is still active if I need to restart the script?

install error

pip install chatgptpy --upgrade

my python version is
Python 2.7.18

ERROR: Could not find a version that satisfies the requirement chatgptpy (from versions: none)
ERROR: No matching distribution found for chatgptpy
need help

Sorry, just one stupid question

ERROR: Could not find a version that satisfies the requirement chatgptpy (from versions: none)
ERROR: No matching distribution found for chatgptpy

IndexError: list index out of range

File "/home/data/PyChatGPT/Classes/auth.py", line 357, in part_eight
access_token = re.findall(r"accessToken":"(.*)"", next_data.text)[0]
IndexError: list index out of range

IndexError: list index out of range

auth.py", line 357, in part_eight

access_token = re.findall(r"accessToken\":\"(.*)\"", next_data.text)[0]

IndexError: list index out of range

【suggest】proxies support socks5

Using proxies: socks5://192.168.2.1:1080
>> Error when calling OpenAI API: Missing dependencies for SOCKS support.
>> Failed to get a response from the API.

Step 8 error

"[OpenAI][8] While most of the process was successful, "
"Auth0 didn't issue an access token, Use proxies or retry."

Then I print the response.text, got:

<script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{}},"page":"/auth/error","query":{},"buildId":"xxx","nextExport":true,"autoExport":true,"isFallback":false,"scriptLoader":[]}</script>

Cloud environments fail to install v1 versions

Heya.

Trying to deploy on Railway (https://github.com/tunnckoCore/chatgpt-api-bottlepy), which seems to use Nix.
But putting aside that, it fails to find the v1 versions.

This is the end of the logs. I have chatgptpy>=1.0.0 in requirements.txt.

#11 7.244      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 195.4/195.4 KB 19.3 MB/s eta 0:00:00
#11 7.271 ERROR: Could not find a version that satisfies the requirement chatgptpy>=1.0.0 (from versions: none)
#11 7.271 ERROR: No matching distribution found for chatgptpy>=1.0.0
 
#11 7.454 WARNING: You are using pip version 22.0.4; however, version 22.3.1 is available.
#11 7.454 You should consider upgrading via the '/opt/venv/bin/python -m pip install --upgrade pip' command.
 
#11 ERROR: executor failed running [/bin/bash -ol pipefail -c python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt]: exit code: 1
 
-----
> [stage-0 7/8] RUN --mount=type=cache,id=s/e7f0188c-eb7a-4375-928c-93a5db1b154e-/root/cache/pip,target=/root/.cache/pip python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt:
-----
executor failed running [/bin/bash -ol pipefail -c python -m venv /opt/venv && . /opt/venv/bin/activate && pip install -r requirements.txt]: exit code: 1
 
Error: Docker build failed

Ideas?

Bug: ImportError: attempted relative import with no known parent package

When I try to run the app I get the following:
C:\Users\Yuriy\Downloads\PyChatGPT-master\src\pychatgpt>python main.py
Traceback (most recent call last):
File "C:\Users\Yuriy\Downloads\PyChatGPT-master\src\pychatgpt\main.py", line 10, in
from .classes import openai as OpenAI
ImportError: attempted relative import with no known parent package

Failed to get a response from the API

Thanks for sharing this work , i've tried two different proxy(protocol ,software& port), and still got this:

>> Access token is valid.
>> Starting CLI chat session...
You: hi
Chat GPT is typing... |-----|Using proxies: http://127.0.0.1:3198
>> Error when calling OpenAI API: HTTPSConnectionPool(host='chat.openai.com', port=443): Max retries exceeded with url: /backend-api/conversation (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1129)')))
>> Failed to get a response from the API.

"IndexError: list index out of range" in auth.py at line 357

Here's the full error message

Traceback (most recent call last):
  File "*\PyChatGPT-master\main.py", line 45, in <module>
    open_ai_auth.begin()

  File "*\PyChatGPT-master\Classes\auth.py", line 127, in begin
    self.part_two()

  File "*\PyChatGPT-master\Classes\auth.py", line 155, in part_two
    self.part_three(token=csrf_token)

  File "*\PyChatGPT-master\Classes\auth.py", line 185, in part_three
    self.part_four(url=url)

  File "*\PyChatGPT-master\Classes\auth.py", line 215, in part_four
    self.part_five(state=state)

  File "*\PyChatGPT-master\Classes\auth.py", line 265, in part_five
    self.part_six(state=state, captcha=None)

  File "*\PyChatGPT-master\Classes\auth.py", line 298, in part_six
    self.part_seven(state=state)

  File "*\PyChatGPT-master\Classes\auth.py", line 333, in part_seven
    self.part_eight(old_state=state, new_state=new_state)

  File "*\PyChatGPT-master\Classes\auth.py", line 357, in part_eight
    access_token = re.findall(r"accessToken\":\"(.*)\"", next_data.text)[0]
IndexError: list index out of range

Add a function to obtain the sentence ChatGPT is thinking about

Although Python cannot perform other operations when using the Ask function to make ChatGpt think, I can separate a thread for PyChatGpt. Can I try to access the thread where PyChatGpt is located in another thread and get the sentences that ChatGpt is generating

Not running on Raspberry Pi?

I try to install on my raspberry pi, and get this error:

ERROR: Could not find a version that satisfies the requirement chatgptpy (from versions: none)
ERROR: No matching distribution found for chatgptpy

Tried manually by downloading the code and running it from Thonny Python IDE, but then I get errors too.

Not possible to run on raspberry pi?

Error, use a proxy

When I added the agent, I made a mistake.

TypeError: __init__() got an unexpected keyword argument 'proxy'

[OpenAI][8] While most of the process was successful, Auth0 didn't issue an access token, Use proxies or retry.

While I was chatting with the bot created with PyChatCPT, it suddenly failed. And When I try to create a new session, exceptions look like below. According to the exception's advice, I may need to use proxies. But I was using proxies, and the proxies worked fine. I can login to chatGPT through web broswer right now, so I guess there might be new problems with PyChatGPT after openai solved its capacity problem.

  File "/home/fury/miniconda3/envs/chatGPT/lib/python3.10/site-packages/pychatgpt/main.py", line 31, in __init__
    self._setup()
    │    └ <function Chat._setup at 0x7f8e693e75b0><pychatgpt.main.Chat object at 0x7f8e68f711b0>
  File "/home/fury/miniconda3/envs/chatGPT/lib/python3.10/site-packages/pychatgpt/main.py", line 71, in _setup
    self._create_access_token()
    │    └ <function Chat._create_access_token at 0x7f8e693e7640><pychatgpt.main.Chat object at 0x7f8e68f711b0>
  File "/home/fury/miniconda3/envs/chatGPT/lib/python3.10/site-packages/pychatgpt/main.py", line 75, in _create_access_token
    openai_auth.create_token()
    │           └ <function Auth.create_token at 0x7f8e694b75b0><pychatgpt.classes.openai.Auth object at 0x7f8e68f71450>
  File "/home/fury/miniconda3/envs/chatGPT/lib/python3.10/site-packages/pychatgpt/classes/openai.py", line 129, in create_token
    self._part_two()
    │    └ <function Auth._part_two at 0x7f8e694b7640><pychatgpt.classes.openai.Auth object at 0x7f8e68f71450>
  File "/home/fury/miniconda3/envs/chatGPT/lib/python3.10/site-packages/pychatgpt/classes/openai.py", line 155, in _part_two
    self._part_three(token=csrf_token)
    │    │                 └ '53e896f36ba4a3063257c50fbf99bfa310951fbd1474ed2c870c223ec6195970'
    │    └ <function Auth._part_three at 0x7f8e694b76d0><pychatgpt.classes.openai.Auth object at 0x7f8e68f71450>
  File "/home/fury/miniconda3/envs/chatGPT/lib/python3.10/site-packages/pychatgpt/classes/openai.py", line 184, in _part_three
    self._part_four(url=url)
    │    │              └ 'https://auth0.openai.com/authorize?client_id=TdJIcbe16WoTHtN95nyywh5E4yOo6ItG&scope=openid%20email%20profile%20offline_acces...
    │    └ <function Auth._part_four at 0x7f8e694b7760>
    └ <pychatgpt.classes.openai.Auth object at 0x7f8e68f71450>
  File "/home/fury/miniconda3/envs/chatGPT/lib/python3.10/site-packages/pychatgpt/classes/openai.py", line 212, in _part_four
    self._part_five(state=state)
    │    │                └ 'hKFo2SA1V2lIYXdGbTZwakduOTNYeVJxQUhHUXpON3FING9RdaFur3VuaXZlcnNhbC1sb2dpbqN0aWTZIHRMMGxFWmlOZTFPWGcyQjVZV25oUlpydnkwN1JyOFhO...
    │    └ <function Auth._part_five at 0x7f8e694b77f0><pychatgpt.classes.openai.Auth object at 0x7f8e68f71450>
  File "/home/fury/miniconda3/envs/chatGPT/lib/python3.10/site-packages/pychatgpt/classes/openai.py", line 260, in _part_five
    self._part_six(state=state, captcha=None)
    │    │               └ 'hKFo2SA1V2lIYXdGbTZwakduOTNYeVJxQUhHUXpON3FING9RdaFur3VuaXZlcnNhbC1sb2dpbqN0aWTZIHRMMGxFWmlOZTFPWGcyQjVZV25oUlpydnkwN1JyOFhO...
    │    └ <function Auth._part_six at 0x7f8e694b7880>
    └ <pychatgpt.classes.openai.Auth object at 0x7f8e68f71450>
  File "/home/fury/miniconda3/envs/chatGPT/lib/python3.10/site-packages/pychatgpt/classes/openai.py", line 292, in _part_six
    self._part_seven(state=state)
    │    │                 └ 'hKFo2SA1V2lIYXdGbTZwakduOTNYeVJxQUhHUXpON3FING9RdaFur3VuaXZlcnNhbC1sb2dpbqN0aWTZIHRMMGxFWmlOZTFPWGcyQjVZV25oUlpydnkwN1JyOFhO...
    │    └ <function Auth._part_seven at 0x7f8e694b7910><pychatgpt.classes.openai.Auth object at 0x7f8e68f71450>
  File "/home/fury/miniconda3/envs/chatGPT/lib/python3.10/site-packages/pychatgpt/classes/openai.py", line 326, in _part_seven
    self._part_eight(old_state=state, new_state=new_state)
    │    │                     │                └ 'tL0lEZiNe1OXg2B5YWnhRZrvy07Rr8XN'
    │    │                     └ 'hKFo2SA1V2lIYXdGbTZwakduOTNYeVJxQUhHUXpON3FING9RdaFur3VuaXZlcnNhbC1sb2dpbqN0aWTZIHRMMGxFWmlOZTFPWGcyQjVZV25oUlpydnkwN1JyOFhO...
    │    └ <function Auth._part_eight at 0x7f8e694b79a0>
    └ <pychatgpt.classes.openai.Auth object at 0x7f8e68f71450>
  File "/home/fury/miniconda3/envs/chatGPT/lib/python3.10/site-packages/pychatgpt/classes/openai.py", line 357, in _part_eight
    raise Exceptions.Auth0Exception("[OpenAI][8] While most of the process was successful, "
          │          └ <class 'pychatgpt.classes.exceptions.Auth0Exception'>
          └ <module 'pychatgpt.classes.exceptions' from '/home/fury/miniconda3/envs/chatGPT/lib/python3.10/site-packages/pychatgpt/classe...

pychatgpt.classes.exceptions.Auth0Exception: [OpenAI][8] While most of the process was successful, Auth0 didn't issue an access token, Use proxies or retry.

[OpenAI][4] IndexError: list index out of range

openai.py", line 211, in _part_four
state = re.findall(r"state=(.*)", response.text)[0]
IndexError: list index out of range

I've tried many times retry the request 。

I have tried to use proxy or not, the same error.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.