def __init__(self, access_key_id, secret_access_key, session_token=None): assert isinstance_str(access_key_id) assert isinstance_str(secret_access_key) assert isinstance_str(session_token) or session_token is None super(AwsCredentials, self).__init__() self._binding = _awscrt.credentials_new(access_key_id, secret_access_key, session_token)
def __init__(self, access_key_id, secret_access_key, session_token=None, expiration=None): assert isinstance(access_key_id, str) assert isinstance(secret_access_key, str) assert isinstance(session_token, str) or session_token is None # C layer uses large int as timestamp for non-expiring credentials if expiration is None: expiration_timestamp = self._NONEXPIRING_TIMESTAMP else: expiration_timestamp = int(expiration.timestamp()) if expiration_timestamp < 0 or expiration_timestamp >= self._NONEXPIRING_TIMESTAMP: raise OverflowError("expiration datetime out of range") super().__init__() self._binding = _awscrt.credentials_new(access_key_id, secret_access_key, session_token, expiration_timestamp)