vsakkas / sydney.py

Python Client for Copilot (formerly named Bing Chat), also known as Sydney.
MIT License
263 stars 37 forks source link

sydney.exceptions.CreateConversationException: Failed to create conversation, received status: 404 #138

Closed RexsyBima closed 9 months ago

RexsyBima commented 9 months ago

i got this error, its weird that i have 404 error code for accessing copilot in python. It was fine few days ago and i dont really use bing chat that much. I've tried to switch account (and also changing the cookie) but still got the error

image

if i go to copilot myself, its all 100% fine. here is my code (same as in the page description)

import asyncio

from sydney import SydneyClient
import os, json

with open("credentials.json") as file:
    credentials = json.load(file)

os.environ["BING_COOKIES"] = credentials["cookie"]

async def main() -> None:
    async with SydneyClient() as sydney:
        while True:
            prompt = input("You: ")

            if prompt == "!reset":
                await sydney.reset_conversation()
                continue
            elif prompt == "!exit":
                break

            print("Sydney: ", end="", flush=True)
            async for response in sydney.ask_stream(prompt):
                print(response, end="", flush=True)
            print("\n")

if __name__ == "__main__":
    asyncio.run(main())
RexsyBima commented 9 months ago

I will try this

https://github.com/vsakkas/sydney.py/issues/109

also do it in another computer with fresh account just in case. will post the update

RexsyBima commented 9 months ago

So im using in another computer, with different account, now i got this captcha error. i've tried change the cookie between 2-5 accounts and they got the same error. Fortunately enough in this other computer, i dont need to change the bing url like in the https://github.com/vsakkas/sydney.py/issues/109

image

i got a feeling that microsoft update some stuffs about the AI bot.

laspir commented 9 months ago

I also got the received status: 404 error today. Until yesterday I could use the library without cookie. Now the only way to use it is to pass a valid cookie otherwise the 404 error occurs every time. I haven't run anything automated with the library so the amount of requests sent are relatively limited. I would be surprised if my usage triggered a user flagging. I'm also looking for a solution but haven't found anything useful so far.

IKDH commented 9 months ago

@RexsyBima to bypass the captcha, did you go to copilote and validate it manually ? Then, you can use the script.

Last time I had 404 error, I could bypass it by retrying the request. This problem disappeared the day after.

RexsyBima commented 9 months ago

I dont see captcha if i go to the bing chat myself

RexsyBima commented 9 months ago

So i did try the solution of https://github.com/vsakkas/sydney.py/issues/109 by changing the BING_CREATE_CONVERSATION_URL from this https://github.com/vsakkas/sydney.py/blob/master/sydney/constants.py#L28 to https://edgeservices.bing.com/edgesvc/turing/conversation/create?bundleVersion=1.1359.6

image

Uniquely after this, you can change back the value of BING_CREATE_CONVERSATION_URL to the default one

Edit :

I take back what i said about "Uniquely after this, you can change back the value of BING_CREATE_CONVERSATION_URL to the default one" it seems that its only working for a few minutes for the default url to be working again. my recommendation is permanently change the BING_CREATE_CONVERSATION_URL value to https://edgeservices.bing.com/edgesvc/turing/conversation/create?bundleVersion=1.1359.6

IKDH commented 9 months ago

Are you using the cookie of a logged in a Microsoft account ?

IKDH commented 9 months ago

@vsakkas I had run some test. With v17.4, I can run the script without cookie. With the last version, I got a 404 error and the only way to bypass this error is to use a cookie from a logged in session.

vsakkas commented 9 months ago

Thank you @IKDH for running the test

It seems kinda weird, since the tests on Github are still running without a cookie, but I will go through the commits and see if there's any reason why this is happening to you

RexsyBima commented 9 months ago

Are you using the cookie of a logged in a Microsoft account ?

Yes

jschmudd commented 9 months ago

I also hit this same issue. I went and tested each version and tracked it down to the v0.18.0 change. v0.17.6 works fine, cookies or not. 18 doesn't work. I will say if I use signed in cookies, at least on 20, I don't get this error but instead get a captcha error. And manually sending a message before fetching cookies doesn't fix that. And no cookies gives the 404 error.

Hopefully that can help. Lmk if there is anything else you need tested.

vsakkas commented 9 months ago

Hi everyone!

I've released v0.20.1 which contains a bunch of fixes. Looks like the API for Copilot had changed a bit (different headers, URLs and bundle versions), so I changed those to improve the compatibility.

I ran the test suite locally using cookies from a logged in account, also on Github without cookies and it worked fine in both scenarios.

It is possible that something might be missing, but let me know if you see any changes with the latest version.

IKDH commented 9 months ago

Hello @vsakkas, it's working without cookie with your last version. I no longer have the 404 error.

Thank you !

jschmudd commented 9 months ago

Hi everyone!

I've released v0.20.1 which contains a bunch of fixes. Looks like the API for Copilot had changed a bit (different headers, URLs and bundle versions), so I changed those to improve the compatibility.

I ran the test suite locally using cookies from a logged in account, also on Github without cookies and it worked fine in both scenarios.

It is possible that something might be missing, but let me know if you see any changes with the latest version.

It seems to fix all issues. Works great even without cookies now. Thank you!

RexsyBima commented 9 months ago

Hi everyone!

I've released v0.20.1 which contains a bunch of fixes. Looks like the API for Copilot had changed a bit (different headers, URLs and bundle versions), so I changed those to improve the compatibility.

I ran the test suite locally using cookies from a logged in account, also on Github without cookies and it worked fine in both scenarios.

It is possible that something might be missing, but let me know if you see any changes with the latest version.

Thanks!! now its all working. altho sometime i have to check the captcha manually but i dont really mind.

vsakkas commented 9 months ago

Glad to know that it worked. Happy new year!!

laspir commented 9 months ago

@vsakkas FYI I just retried again with version 0.20.0, with which I got the 404 error a few days ago, before upgrading, to do a before/after check. However Version 0.20.0 seems to work again for me, even without cookie. This would suggest the API changes in 0.20.1 may not be the cause of this error after all? I'll keep monitoring.