vsakkas / sydney.py

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

Failed to run the example code 403 #148

Open seriable opened 8 months ago

seriable commented 8 months ago

When I running the example code import asyncio

from sydney import SydneyClient

import os os.environ["BING_COOKIES"] = "......."

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())

It happened a error raise CreateConversationException( sydney.exceptions.CreateConversationException: Failed to create conversation, received status: 403 Unclosed client session client_session: <aiohttp.client.ClientSession object at 0x000001D5B8C19930> Unclosed connector

Could you help me to solve the problem

Krasuszz commented 7 months ago

I meet the same problem and I think the reason is the IP where you got cookies and where you run the client is not the same. It might be easy to solve if author adds a proxy method for the client.

Cyberes commented 5 months ago

@Krasuszz I'm not sure the IP difference is the problem. I was running it using a proxy that was a different IP than where I got my cookie.

beingfanfan commented 5 months ago

@Krasuszz I'm not sure the IP difference is the problem. I was running it using a proxy that was a different IP than where I got my cookie.

Could you please tell me how to run the code using a proxy? When I specify the proxy parameter, I get an HTTP 200 error. The only solution I currently know is to deploy the code on a server with a physical IP in the United States.