snowby666 / poe-api-wrapper

👾 A Python API wrapper for Poe.com. With this, you will have free access to GPT-4, Claude, Llama, Gemini, Mistral and more! 🚀
https://pypi.org/project/poe-api-wrapper/
GNU General Public License v3.0
677 stars 81 forks source link

With proxy, websocket error #143

Closed wupan-olo closed 1 week ago

wupan-olo commented 2 months ago

env:

# model
gpt_4_128 = 'vizcacha'
gpt_4 = 'beaver'
gpt_35 = 'gpt3_5'

# proxy 
proxy_config = [
    {"https":"socks5://127.0.0.1:7890",
     "http":"socks5://127.0.0.1:7890"}
]

msg = 'Hi, introduce yourself'

client = poe.PoeApi(cookie=poe_token, proxy=proxy_config)
 # no-stream read:
for chunk in client.send_message(bot= gpt_35, message = msg):
   pass
print(chunk["text"])

It work well for print(client.get_chat_history()['data'])

err log:

/Users/wupan/anaconda3/envs/prompt/lib/python3.9/site-packages/websocket/_app.py:356: ResourceWarning: unclosed <socket.socket fd=79, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('172.31.8.156', 60556)> return not isinstance(e, KeyboardInterrupt) ResourceWarning: Enable tracemalloc to get the object allocation traceback 2024-04-16 10:29:12.936 | INFO | poe_api_wrapper.api:select_proxy:80 - Connection failed with {'https': 'socks5://127.0.0.1:7890', 'http': 'socks5://127.0.0.1:7890'}. Trying 1/1 ... 2024-04-16 10:29:13.835 | WARNING | poe_api_wrapper.api:on_ws_close:201 - Connection to remote host was lost. Reconnecting... 2024-04-16 10:29:20.631 | WARNING | poe_api_wrapper.api:on_ws_close:201 - Connection to remote host was lost. Reconnecting...

snowby666 commented 1 week ago

This is be fixed in v.1.5.4