Align datetime import in fiat_convert
This commit is contained in:
		| @@ -3,8 +3,8 @@ Module that define classes to convert Crypto-currency to FIAT | ||||
| e.g BTC to USD | ||||
| """ | ||||
|  | ||||
| import datetime | ||||
| import logging | ||||
| from datetime import datetime | ||||
| from typing import Dict, List | ||||
|  | ||||
| from cachetools import TTLCache | ||||
| @@ -67,7 +67,7 @@ class CryptoToFiatConverter(LoggingMixin): | ||||
|                 logger.warning( | ||||
|                     "Too many requests for CoinGecko API, backing off and trying again later.") | ||||
|                 # Set backoff timestamp to 60 seconds in the future | ||||
|                 self._backoff = datetime.datetime.now().timestamp() + 60 | ||||
|                 self._backoff = datetime.now().timestamp() + 60 | ||||
|                 return | ||||
|             # If the request is not a 429 error we want to raise the normal error | ||||
|             logger.error( | ||||
| @@ -81,7 +81,7 @@ class CryptoToFiatConverter(LoggingMixin): | ||||
|  | ||||
|     def _get_gekko_id(self, crypto_symbol): | ||||
|         if not self._coinlistings: | ||||
|             if self._backoff <= datetime.datetime.now().timestamp(): | ||||
|             if self._backoff <= datetime.now().timestamp(): | ||||
|                 self._load_cryptomap() | ||||
|                 # Still not loaded. | ||||
|                 if not self._coinlistings: | ||||
|   | ||||
		Reference in New Issue
	
	Block a user