Example #1
0
 def _check_for_system_clock_not_synced_error(
     error_code: Optional[int] = None, ) -> None:
     if error_code == API_SYSTEM_CLOCK_NOT_SYNCED_ERROR_CODE:
         raise SystemClockNotSyncedError(
             current_time=str(datetime.now()),
             remote_server='Bitstamp',
         )
Example #2
0
    def _check_for_system_clock_not_synced_error(response: Response) -> None:
        if response.status_code == HTTPStatus.UNAUTHORIZED:
            try:
                result = rlk_jsonloads_dict(response.text)
            except JSONDecodeError:
                raise RemoteError(f'Bittrex returned invalid JSON response: {response.text}')

            if result.get('code', None) == 'INVALID_TIMESTAMP':
                raise SystemClockNotSyncedError(
                    current_time=str(datetime.now()),
                    remote_server='Bittrex',
                )
        return None
Example #3
0
    side_effect=mock_validate_api_key,
)
API_KEYPAIR_COINBASEPRO_VALIDATION_PATCH = patch(
    'rotkehlchen.exchanges.coinbasepro.Coinbasepro.validate_api_key',
    return_value=(True, ''),
)

API_KEYPAIR_COINBASE_VALIDATION_PATCH = patch(
    'rotkehlchen.exchanges.coinbase.Coinbase.validate_api_key',
    return_value=(True, ''),
)

SYSTEM_CLOCK_NOT_SYNCED_RESPONSE_BITFINEX = patch(
    'rotkehlchen.exchanges.bitfinex.Bitfinex.validate_api_key',
    side_effect=SystemClockNotSyncedError(
        current_time=str(datetime.now()),
        remote_server='Bitfinex',
    ),
)

SYSTEM_CLOCK_NOT_SYNCED_RESPONSE_BITTREX = patch(
    'rotkehlchen.exchanges.bittrex.Bittrex._check_for_system_clock_not_synced_error',
    side_effect=SystemClockNotSyncedError(
        current_time=str(datetime.now()),
        remote_server='Bittrex',
    ),
)

SYSTEM_CLOCK_NOT_SYNCED_RESPONSE_BITSTAMP = patch(
    'rotkehlchen.exchanges.bitstamp.Bitstamp.validate_api_key',
    side_effect=SystemClockNotSyncedError(
        current_time=str(datetime.now()),