Open Srilakshmi-Dirisala opened 11 months ago
I'm having same kind of issue when accessing coinmarketcap API. It does not happen regularly but doesn't feel the frequency of happening it is good. Time to time I get this error.
HTTPSConnectionPool(host='pro-api.coinmarketcap.com', port=443): Max retries exceeded with url: /v1/cryptocurrency/listings/latest?start=1&limit=200 (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x7fe54487dbb0>: Failed to resolve 'pro-api.coinmarketcap.com' ([Errno -2] Name or service not known)"))
Used Python version 3.9 for it to run on a docker container. But used Python 3.12 for development.
Need to try using different python version. Feels that there is something going with Python requests library.
2023-12-13 11:53:05,058 - crypto_trading_logger - INFO - Starting bridge bridge hourtokeepscouthistory hourtokeepscouthistory scout_multiplier scout_multiplier scout_sleep_time scout_sleep_time api_key api_key api_secret_key api_secret_key tld tld current_coin current_coin strategy strategy sell_timeout sell_timeout buy_timeout buy_timeout Traceback (most recent call last): File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 203, in _new_conn sock = connection.create_connection( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\connection.py", line 60, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\socket.py", line 962, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ socket.gaierror: [Errno 11001] getaddrinfo failed
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 790, in urlopen response = self._make_request( ^^^^^^^^^^^^^^^^^^^ File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 491, in _make_request raise new_e File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 467, in _make_request self._validate_conn(conn) File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 1092, in _validate_conn
conn.connect() File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 611, in connect self.sock = sock = self._new_conn() ^^^^^^^^^^^^^^^^ File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connection.py", line 210, in _new_conn raise NameResolutionError(self.host, self, e) from e urllib3.exceptions.NameResolutionError: <urllib3.connection.HTTPSConnection object at 0x000001E34914CCD0>: Failed to resolve 'api.binance.'com'' ([Errno 11001] getaddrinfo failed)
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\adapters.py", line 486, in send resp = conn.urlopen( ^^^^^^^^^^^^^ File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\connectionpool.py", line 844, in urlopen retries = retries.increment( ^^^^^^^^^^^^^^^^^^ File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\urllib3\util\retry.py", line 515, in increment raise MaxRetryError(_pool, url, reason) from reason # type: ignore[arg-type] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host="api.binance.'com'", port=443): Max retries exceeded with url: /api/v3/ping (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x000001E34914CCD0>: Failed to resolve 'api.binance.'com'' ([Errno 11001] getaddrinfo failed)"))
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "D:\binance-trade-bot\binance_trade_bot__main.py", line 5, in
main()
File "D:\binance-trade-bot\binance_trade_bot\crypto_trading.py", line 18, in main
manager = BinanceAPIManager(config, db, logger)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\binance-trade-bot\binance_trade_bot\binance_api_manager.py", line 27, in init
self.binance_client = Client(
^^^^^^^
File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\binance\client.py", line 132, in init__
self.ping()
File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\binance\client.py", line 447, in ping
return self._get('ping', version=self.PRIVATE_API_VERSION)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\binance\client.py", line 292, in _get
return self._request_api('get', path, signed, version, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\binance\client.py", line 242, in _request_api
return self._request(method, uri, signed, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\binance\client.py", line 236, in _request
self.response = getattr(self.session, method)(uri, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 602, in get
return self.request("GET", url, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 589, in request
resp = self.send(prep, send_kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\sessions.py", line 703, in send
r = adapter.send(request, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\srila\AppData\Local\Programs\Python\Python311\Lib\site-packages\requests\adapters.py", line 519, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host="api.binance.'com'", port=443): Max retries exceeded with url: /api/v3/ping (Caused by NameResolutionError("<urllib3.connection.HTTPSConnection object at 0x000001E34914CCD0>: Failed to resolve 'api.binance.'com'' ([Errno 11001] getaddrinfo failed)"))