Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERR_CHALLENGE error ? #22

Open
cleesmith opened this issue Dec 20, 2024 · 4 comments
Open

ERR_CHALLENGE error ? #22

cleesmith opened this issue Dec 20, 2024 · 4 comments

Comments

@cleesmith
Copy link

cleesmith commented Dec 20, 2024

python 3.12.8
pip install -U https://github.com/mrgick/duckduckgo-chat-ai/archive/master.zip

I always see: ERR_CHALLENGE
... maybe from: duck_chat/duck_chat/api.py line 110: raise DuckChatException(err_message) but i don't see that error in the repo?

... or duck_chat, i see:

(duck_chat) cleesmith:~$ python -m duck_chat
Using claude-3-haiku-20240307
Type /help to display the help
>>> User input №1:
hello
>>> Response №1:
Error occurred: ERR_CHALLENGE
>>> User input №1:
Traceback (most recent call last):
  File "/opt/miniconda3/envs/duck_chat/lib/python3.12/site-packages/duck_chat/cli.py", line 67, in run
    user_input = self.get_user_input()
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/duck_chat/lib/python3.12/site-packages/duck_chat/cli.py", line 95, in get_user_input
    user_input = input()
                 ^^^^^^^
  File "/opt/miniconda3/envs/duck_chat/lib/python3.12/asyncio/runners.py", line 157, in _on_sigint
    raise KeyboardInterrupt()
KeyboardInterrupt

... or using code example:

import asyncio
from duck_chat import DuckChat

async def main():
    async with DuckChat() as chat:
        print(await chat.ask_question("2+2?"))
        await asyncio.sleep(1)
        print(await chat.ask_question("6+6?"))

asyncio.run(main())

(duck_chat) cleesmith:~$ python -B cls.py

... i see:

Traceback (most recent call last):
  File "/Users/cleesmith/duck_chat/cls.py", line 10, in <module>
    asyncio.run(main())
  File "/opt/miniconda3/envs/duck_chat/lib/python3.12/asyncio/runners.py", line 194, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/duck_chat/lib/python3.12/asyncio/runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/duck_chat/lib/python3.12/asyncio/base_events.py", line 686, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "/Users/cleesmith/duck_chat/cls.py", line 6, in main
    print(await chat.ask_question("2+2?"))
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/duck_chat/lib/python3.12/site-packages/duck_chat/api.py", line 121, in ask_question
    message = await self.get_answer()
              ^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/miniconda3/envs/duck_chat/lib/python3.12/site-packages/duck_chat/api.py", line 110, in get_answer
    raise DuckChatException(err_message)
duck_chat.exceptions.DuckChatException: ERR_CHALLENGE
@ReallyWeirdCat
Copy link

Same thing, apparently they resist automatic requests now

@HydraDragonAntivirus
Copy link

HydraDragonAntivirus commented Dec 31, 2024

They probably fixed auto bot like requests. So, you failed captcha test.

@Legends-of-NGDB
Copy link

Legends-of-NGDB commented Jan 15, 2025

Any updates on this?

Here is my raw response:

{"action":"error","status":418,"type":"ERR_CHALLENGE","overrideCode":"b46b","cd":{"cc":"duckchat","e":0,"er":null,"gk":0,"i":"3","iadb":1,"o":"pTHF7sUYy4pHMYhsbUeoeppLNdGPzHhRBRU0wj56nm6MSgYA5Hjumqwvz1FDXEnK%0A","p":"eefbca2019c84d259e4855e7d3b94a85-6cc56ef6960946b7b63c0250878e085e-cbde47337b1642ffb87a097633bd95f5-680872170de9477d9fde180d3b6eabd7-189bb05e30d14d9fa5954255fec981f5-5985cbeac86a47e0a8986197ca42e027-2cf1c84b886c4c339792bd8029da27bc-68b1202301f9410fb071405447975abb-720d685b76ac4756a2055ac8fa9bfb46","q":"","r":"use","s":"aichat","sc":1}}

@Sabdot33
Copy link

Nope! i don't think so, because they said they would allow third party clients to access the thing.
Also, requesting like this works:

        async def create_custom_session():
            return aiohttp.ClientSession(
                headers={"User-Agent": "DuckChat Client",
                         "Connection": "keep-alive",
                         "Cookie": "yourcookies",
                         "x-vqd-4": "idk_what_this_is_for_its_probably_server_side_session_tracking"
                         },
                timeout=aiohttp.ClientTimeout(total=30)
            )

        custom_session = await create_custom_session()

        try:
            chat = DuckChat(session=custom_session)
            answer = await chat.ask_question(prompt)
            return answer
        finally:
            await custom_session.close()

but when i tried using a real browser-alike UA "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:134.0) Gecko/20100101 Firefox/134.0" i would get the ERR_CHALLENGE again.
Also, i don't think that the cookies are necessary but i just included them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants