Coder Social home page Coder Social logo

Comments (3)

snowby666 avatar snowby666 commented on June 12, 2024

image
I think its a bug. I tested with a proxy and it worked normally.

from poe-api-wrapper.

srcao-bingo avatar srcao-bingo commented on June 12, 2024

这么设置好像行不通,需要在 api.py 中进一步修改吗?
image

2024-03-20 10:20:06.357 | WARNING | poe_api_wrapper.api:on_ws_close:296 - Connection to remote host was lost. Reconnecting...
2024-03-20 10:20:15.887 | INFO | poe_api_wrapper.api:select_proxy:126 - Connection failed with {'https': 'socks5://127.0.0.1:7890', 'http': 'socks5://127.0.0.1:7890'}. Trying 1/1 ...
2024-03-20 10:20:30.446 | WARNING | poe_api_wrapper.api:on_ws_close:296 - Connection to remote host was lost. Reconnecting...
2024-03-20 10:20:54.176 | WARNING | poe_api_wrapper.api:on_ws_close:296 - Connection to remote host was lost. Reconnecting...
Traceback (most recent call last):
File "E:\OneDrive\2-code\Source\utils\poe-api-wrapper-V2\poe_api_wrapper_v2_main.py", line 40, in
for chunk in client.send_message(bot, message):
File "C:\Users\cao.conda\envs\poe-api-wrapper\lib\site-packages\poe_api_wrapper\api.py", line 691, in send_message
self.connect_ws()
File "C:\Users\cao.conda\envs\poe-api-wrapper\lib\site-packages\poe_api_wrapper\api.py", line 280, in connect_ws
raise RuntimeError("Timed out waiting for websocket to connect.")
RuntimeError: Timed out waiting for websocket to connect.

from poe-api-wrapper.

PMajesty avatar PMajesty commented on June 12, 2024

Yeah. I managed to fix the proxy problem by modifying the code a bit, but now the connection times out. I managed to work around it like this, but it is a clunky solution and it's far from perfect:

async def send_bot_message(bot_name, chat_id, text):
    global client  # Declare client as global within this function
    while True:
        try:
            response_chunks = []
            for chunk in client.send_message(bot_name, text, chatId=chat_id):
                response_chunks.append(chunk["response"])
            return ''.join(response_chunks)
        except requests.exceptions.ConnectionError:
            client = PoeApi(cookie=tokens, proxy=proxy_url)

Please take a look at this problem

from poe-api-wrapper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.