vsakkas / sydney.py

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

Python client creation failed, appreciate any support! #121

Closed lingchenmsot closed 10 months ago

lingchenmsot commented 10 months ago

All work perfect on v0.15.x till hours ago, suddenly the client creation failed and never went back. I tried following but not work at all: 1) upgrade to 0.18.0; 2) get some new _U cookies or the _U cookie of copilot.microsoft.com; 3) reboot PC, restart VS Code...
About my usage:

  1. define a bing_u_cookie = ["16*ogeo", "1_m0ya***KBw", "1w7KXk", "1BA***BSg"]
  2. then create the chat bot: async with SydneyClient(bing_u_cookie = random_cookie, style="precise") as sydney:
  3. then I got an exception during the creation. Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x00000245FDBD6890> Unclosed connector connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x00000245FDA77540>, 901535.312)]'] connector: <aiohttp.connector.TCPConnector object at 0x00000245FDBD6A90>
vsakkas commented 10 months ago

Hi @lingchenmsot Version 0.18 no longer uses the _U cookie as it is no enough to fully convince the Bing Chat server that you're a logged in user. Please have a look at the README for updated instructions or try to use the library without cookies (which works in some regions)

DavidAI2024 commented 10 months ago

I use cookie-editor a Chrome extension and I have 3 methods to copy all cookies. json, netscape , "header string" how do I copy it? @vsakkas 😵‍💫

vsakkas commented 10 months ago

@BlackDicky I am not familiar with this extension (I will check it asap though!), but I think header string might be the right option. Sydney.py does the parsing of the cookies itself, so no need for json!

DavidAI2024 commented 10 months ago

I just did with version0.18.0 but I getFile "/Users/davide/Documents/tutto/jfkdjhfdi.py", line 10, in main await conversation_loop(sydney, colors, color_index) File "/Users/davide/Documents/tutto/jfkdjhfdi.py", line 24, in conversation_loop async for response, suggested_responses in sydney.ask_stream(prompt, suggestions=True): File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/sydney/sydney.py", line 453, in ask_stream async for response, suggested_responses in self._ask( File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages/sydney/sydney.py", line 233, in _ask raise CaptchaChallengeException("Solve CAPTCHA to continue") sydney.exceptions.CaptchaChallengeException: Solve CAPTCHA to continue Despite if I go to Bing.com and write a message in the chat no "VErifica that you are a human" appears @vsakkas

vsakkas commented 10 months ago

Hm, just to be sure, did you copy the cookies from https://copilot.microsoft.com ?

vsakkas commented 10 months ago

@lingchenmsot I've released version 0.18.1 which fixes a bit the cookie parsing, so if you're using extensions such as Cookies-Editor to get the cookies, it should work now!

Make sure to use the BING_COOKIES environment variable

lingchenmsot commented 10 months ago

You guys rock! Thanks so much for quick response at weekend. And yes, after following readme and copy cookie to set up os environment, the problem is fixed.