Skip to content

"[SSL: WRONG_VERSION_NUMBER] wrong version number" #87

@desword

Description

@desword

Following the get_bot_response example from the developer documentation returns "[SSL: WRONG_VERSION_NUMBER] wrong version number" for all attempts.

Environment Details:

Python 3.10.12
fastapi_poe 0.0.36
httpx 0.27.0
httpx-sse 0.4.0

Stacktrace:

Error in Poe bot: Bot request to GPT-3.5-Turbo failed on try 0 
 SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1007)')
Error in Poe bot: Bot request to GPT-3.5-Turbo failed on try 1 
 SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1007)')
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/fastapi_poe/client.py", line 459, in stream_request_base
    async for message in ctx.perform_query_request(
  File "/usr/local/lib/python3.10/dist-packages/fastapi_poe/client.py", line 146, in perform_query_request
    async with httpx_sse.aconnect_sse(
  File "/usr/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/usr/local/lib/python3.10/dist-packages/httpx_sse/_api.py", line 69, in aconnect_sse
    async with client.stream(method, url, headers=headers, **kwargs) as response:
  File "/usr/lib/python3.10/contextlib.py", line 199, in __aenter__
    return await anext(self.gen)
  File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1617, in stream
    response = await self.send(
  File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1661, in send
    response = await self._send_handling_auth(
  File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1689, in _send_handling_auth
    response = await self._send_handling_redirects(
  File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1726, in _send_handling_redirects
    response = await self._send_single_request(request)
  File "/usr/local/lib/python3.10/dist-packages/httpx/_client.py", line 1763, in _send_single_request
    response = await transport.handle_async_request(request)
  File "/usr/local/lib/python3.10/dist-packages/httpx/_transports/default.py", line 373, in handle_async_request
    resp = await self._pool.handle_async_request(req)
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/connection_pool.py", line 216, in handle_async_request
    raise exc from None
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/connection_pool.py", line 196, in handle_async_request
    response = await connection.handle_async_request(
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/connection.py", line 99, in handle_async_request
    raise exc
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/connection.py", line 76, in handle_async_request
    stream = await self._connect(request)
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_async/connection.py", line 154, in _connect
    stream = await stream.start_tls(**kwargs)
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_backends/anyio.py", line 80, in start_tls
    raise exc
  File "/usr/local/lib/python3.10/dist-packages/httpcore/_backends/anyio.py", line 71, in start_tls
    ssl_stream = await anyio.streams.tls.TLSStream.wrap(
  File "/usr/local/lib/python3.10/dist-packages/anyio/streams/tls.py", line 132, in wrap
    await wrapper._call_sslobject_method(ssl_object.do_handshake)
  File "/usr/local/lib/python3.10/dist-packages/anyio/streams/tls.py", line 140, in _call_sslobject_method
    result = func(*args)
  File "/usr/lib/python3.10/ssl.py", line 975, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1007)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/access_api_directly.py", line 15, in <module>
    asyncio.run(get_responses(api_key, [message]))
  File "/usr/lib/python3.10/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/usr/lib/python3.10/asyncio/base_events.py", line 649, in run_until_complete
    return future.result()
  File "/home/access_api_directly.py", line 6, in get_responses
    async for partial in fp.get_bot_response(messages=messages, bot_name="GPT-3.5-Turbo", api_key=api_key):
  File "/usr/local/lib/python3.10/dist-packages/fastapi_poe/client.py", line 330, in stream_request
    async for message in stream_request_base(
  File "/usr/local/lib/python3.10/dist-packages/fastapi_poe/client.py", line 484, in stream_request_base
    raise BotError(f"Error communicating with bot {bot_name}") from e
fastapi_poe.client.BotError: Error communicating with bot GPT-3.5-Turbo

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions