Forums

Please, add the OpenAI API

Today I faced such a problem:

Task exception was never retrieved future: <Task finished name='Task-7' coro=<Dispatcher._process_polling_updates() done, defined at /home/svkl/.local/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py:407> exception=TypeError("'coroutine' object is not subscriptable")> Traceback (most recent call last): File "/home/svkl/main.py", line 273, in handle_messages response_content, response = await call_openai(message) File "/home/svkl/main.py", line 324, in call_openai /home/svkl/.local/lib/python3.10/site-packages/openai/datalib/numpy_helper.py:4: UserWarning: The NumPy module was reloaded (imported a second time). This can in some cases result in small but subtle issues and is discouraged. import numpy Task exception was never retrieved future: <Task finished name='Task-335' coro=<Dispatcher._process_polling_updates() done, defined at /home/svkl/.local/lib/python3.10/site-packages/aiogram/dispatcher/dispatcher.py:407> exception=APIConnectionError(message='Error communicating with OpenAI', http_status=None, request_id=None)> Traceback (most recent call last): File "/home/svkl/.local/lib/python3.10/site-packages/aiohttp/connector.py", line 980, in _wrap_create_connection return await self._loop.create_connection(args, **kwargs) # type: ignore[return-value] # noqa File "/usr/local/lib/python3.10/asyncio/selector_events.py", line 535, in _sock_connect_cb raise OSError(err, f'Connect call failed {address}') ConnectionRefusedError: [Errno 111] Connect call failed ('104.18.7.192', 443)

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

Traceback (most recent call last): raise client_error(req.connection_key, exc) from exc aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host api.openai.com:443 ssl:default [Connect call failed ('104.18.7.192', 443)]

The above exception was the direct cause of the following exception: raise error.APIConnectionError("Error communicating with OpenAI") from e openai.error.APIConnectionError: Error communicating with OpenAI*

Please, add the OpenAI API, url=https://platform.openai.com/docs/api-reference/

Please visit this help page, you'll find a link to the form which you can fill in to request the allowlist addition. https://help.pythonanywhere.com/pages/RequestingAllowlistAdditions