theAbdoSabbagh / UnlimitedGPT

An unofficial Python wrapper for OpenAI's ChatGPT API
https://pypi.org/project/UnlimitedGPT/
GNU General Public License v3.0
346 stars 43 forks source link

Headless driver prevents code from running #45

Open bhav09 opened 11 months ago

bhav09 commented 11 months ago

Description

When I run the code with headless=True, it doesn't execute.

Steps to Reproduce

I am running the below code:

api = ChatGPT(
    session_token,
    proxy=None,
    disable_moderation=False,
    verbose=False,
    headless=True
)
message = api.send_message(
    "Hey ChatGPT!",
    input_mode="INSTANT", # Can be INSTANT or SLOW
    input_delay=0.1, # Only used when input_mode is set to SLOW
)
print(message.response, message.conversation_id)

Error Message or Traceback

If applicable, include the complete error message or traceback you received. This will help us in identifying the problem more quickly.

Traceback (most recent call last):
  File "venv/lib/python3.10/site-packages/UnlimitedGPT/UnlimitedGPT.py", line 263, in _ensure_cf
    WebDriverWait(self.driver, 10).until_not(
  File "venv/lib/python3.10/site-packages/UnlimitedGPT/UnlimitedGPT.py", line 118, in until_not
    raise TimeoutException(message)
selenium.common.exceptions.TimeoutException: Message: 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "venv/lib/python3.10/site-packages/UnlimitedGPT/UnlimitedGPT.py", line 263, in _ensure_cf
    WebDriverWait(self.driver, 10).until_not(
  File "venv/lib/python3.10/site-packages/UnlimitedGPT/UnlimitedGPT.py", line 118, in until_not
    raise TimeoutException(message)
selenium.common.exceptions.TimeoutException: Message: 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "venv/lib/python3.10/site-packages/UnlimitedGPT/UnlimitedGPT.py", line 263, in _ensure_cf
    WebDriverWait(self.driver, 10).until_not(
  File "venv/lib/python3.10/site-packages/UnlimitedGPT/UnlimitedGPT.py", line 118, in until_not
    raise TimeoutException(message)
selenium.common.exceptions.TimeoutException: Message: 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "venv/lib/python3.10/site-packages/UnlimitedGPT/UnlimitedGPT.py", line 263, in _ensure_cf
    WebDriverWait(self.driver, 10).until_not(
  File "venv/lib/python3.10/site-packages/UnlimitedGPT/UnlimitedGPT.py", line 118, in until_not
    raise TimeoutException(message)
selenium.common.exceptions.TimeoutException: Message: 

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/main.py", line 16, in <module>
    api = ChatGPT(
  File "venv/lib/python3.10/site-packages/UnlimitedGPT/UnlimitedGPT.py", line 77, in __init__
    self._init_browser()
  File "venv/lib/python3.10/site-packages/UnlimitedGPT/UnlimitedGPT.py", line 189, in _init_browser
    self._ensure_cf()
  File "venv/lib/python3.10/site-packages/UnlimitedGPT/UnlimitedGPT.py", line 272, in _ensure_cf
    return self._ensure_cf(retry - 1)
  File "venv/lib/python3.10/site-packages/UnlimitedGPT/UnlimitedGPT.py", line 272, in _ensure_cf
    return self._ensure_cf(retry - 1)
  File "venv/lib/python3.10/site-packages/UnlimitedGPT/UnlimitedGPT.py", line 272, in _ensure_cf
    return self._ensure_cf(retry - 1)
  File "venv/lib/python3.10/site-packages/UnlimitedGPT/UnlimitedGPT.py", line 273, in _ensure_cf
    raise ValueError("Cloudflare challenge failed")
ValueError: Cloudflare challenge failed

Environment Information

Please provide details about your environment:

Expected Behavior

Describe what you expected to happen when encountering the issue.

Possible Solutions

If you have any ideas or suggestions for resolving the issue, please mention them here.

Checklist

Before submitting the issue, please ensure that you have done the following:

Thank you for taking the time to report this issue. Your contribution helps improve UnlimitedGPT for everyone!

TheFoodies2024 commented 1 month ago

same.