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

RuntimeError: Timed out waiting for websocket to connect. #47

Closed
ngbruce opened this issue Sep 18, 2023 · 7 comments
Closed

RuntimeError: Timed out waiting for websocket to connect. #47

ngbruce opened this issue Sep 18, 2023 · 7 comments
Labels
bug Something isn't working

Comments

@ngbruce
Copy link

ngbruce commented Sep 18, 2023

Env:
Pycharm + anaconda

Network:
proxy which works fine for EDGE broswer

Issue:
When I try run a demo as below, it return an error of
"RuntimeError: Timed out waiting for websocket to connect."

demo code:
from poe_api_wrapper import PoeExample
token = "my_cookies_copied_from_EDGE"
PoeExample(token).chat_with_bot()

@snowby666
Copy link
Owner

Is it working in the new release?

@ngbruce
Copy link
Author

ngbruce commented Sep 20, 2023

Is it working in the new release?

still no good.
I hard reset the project to latest but still get error:
Traceback (most recent call last):
File "D:\MY_DOCUMENTS\Python_Projs\My_Apps\poe-api-wrapper\myTest.py", line 3, in
PoeExample(token).chat_with_bot()
File "D:\MY_DOCUMENTS\Python_Projs\My_Apps\poe-api-wrapper\poe_api_wrapper\example.py", line 6, in init
self.client = PoeApi(cookie=self.cookie)
File "D:\MY_DOCUMENTS\Python_Projs\My_Apps\poe-api-wrapper\poe_api_wrapper\api.py", line 147, in init
self.connect_ws()
File "D:\MY_DOCUMENTS\Python_Projs\My_Apps\poe-api-wrapper\poe_api_wrapper\api.py", line 263, in connect_ws
raise RuntimeError("Timed out waiting for websocket to connect.")
RuntimeError: Timed out waiting for websocket to connect.

@snowby666
Copy link
Owner

I see. I think the ws connection has some issues when you are behind a proxy. I will try to reproduce this and do further research

@snowby666 snowby666 added the bug Something isn't working label Sep 20, 2023
@ngbruce
Copy link
Author

ngbruce commented Sep 20, 2023

I see. I think the ws connection has some issues when you are behind a proxy. I will try to reproduce this and do further research

Yes, I think some where in the code doesnt work fine with proxy.
If I turn off the proxy, it will be error in get_formkey() of api.py.
When the proxy is on, the function can get the correct formkey.

@snowby666
Copy link
Owner

I will change the get_form_key method

@ngbruce
Copy link
Author

ngbruce commented Sep 21, 2023

I will change the get_form_key method

What I mean is, the get_formkey() function is fine.
It was just a test shows that the peoject can go through the proxy and return the formkey. I think the problem is some where after getting the formkey, some thing wrong with ws with proxy.

@asyu17
Copy link

asyu17 commented Dec 14, 2023

same problem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants