Python botocore.exceptions.UnknownSignatureVersionError() Examples
The following are 17
code examples of botocore.exceptions.UnknownSignatureVersionError().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
botocore.exceptions
, or try the search function
.
Example #1
Source File: client.py From aws-builders-fair-projects with Apache License 2.0 | 6 votes |
def _resolve_signature_version(self, service_name, resolved): configured_version = _get_configured_signature_version( service_name, self.client_config, self.scoped_config) if configured_version is not None: return configured_version # Pick a signature version from the endpoint metadata if present. if 'signatureVersions' in resolved: potential_versions = resolved['signatureVersions'] if service_name == 's3': return 's3v4' if 'v4' in potential_versions: return 'v4' # Now just iterate over the signature versions in order until we # find the first one that is known to Botocore. for known in potential_versions: if known in AUTH_TYPE_MAPS: return known raise UnknownSignatureVersionError( signature_version=resolved.get('signatureVersions'))
Example #2
Source File: client.py From deepWordBug with Apache License 2.0 | 6 votes |
def _resolve_signature_version(self, service_name, resolved): configured_version = _get_configured_signature_version( service_name, self.client_config, self.scoped_config) if configured_version is not None: return configured_version # Pick a signature version from the endpoint metadata if present. if 'signatureVersions' in resolved: potential_versions = resolved['signatureVersions'] if service_name == 's3': return 's3v4' if 'v4' in potential_versions: return 'v4' # Now just iterate over the signature versions in order until we # find the first one that is known to Botocore. for known in potential_versions: if known in AUTH_TYPE_MAPS: return known raise UnknownSignatureVersionError( signature_version=resolved.get('signatureVersions'))
Example #3
Source File: client.py From aws-extender with MIT License | 6 votes |
def _resolve_signature_version(self, service_name, resolved): configured_version = _get_configured_signature_version( service_name, self.client_config, self.scoped_config) if configured_version is not None: return configured_version # Pick a signature version from the endpoint metadata if present. if 'signatureVersions' in resolved: potential_versions = resolved['signatureVersions'] if service_name == 's3': return 's3v4' if 'v4' in potential_versions: return 'v4' # Now just iterate over the signature versions in order until we # find the first one that is known to Botocore. for known in AUTH_TYPE_MAPS: if known in potential_versions: return known raise UnknownSignatureVersionError( signature_version=resolved.get('signatureVersions'))
Example #4
Source File: client.py From bash-lambda-layer with MIT License | 6 votes |
def _resolve_signature_version(self, service_name, resolved): configured_version = _get_configured_signature_version( service_name, self.client_config, self.scoped_config) if configured_version is not None: return configured_version # Pick a signature version from the endpoint metadata if present. if 'signatureVersions' in resolved: potential_versions = resolved['signatureVersions'] if service_name == 's3': return 's3v4' if 'v4' in potential_versions: return 'v4' # Now just iterate over the signature versions in order until we # find the first one that is known to Botocore. for known in potential_versions: if known in AUTH_TYPE_MAPS: return known raise UnknownSignatureVersionError( signature_version=resolved.get('signatureVersions'))
Example #5
Source File: client.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 6 votes |
def _resolve_signature_version(self, service_name, resolved): configured_version = _get_configured_signature_version( service_name, self.client_config, self.scoped_config) if configured_version is not None: return configured_version # Pick a signature version from the endpoint metadata if present. if 'signatureVersions' in resolved: potential_versions = resolved['signatureVersions'] if service_name == 's3': return 's3v4' if 'v4' in potential_versions: return 'v4' # Now just iterate over the signature versions in order until we # find the first one that is known to Botocore. for known in potential_versions: if known in AUTH_TYPE_MAPS: return known raise UnknownSignatureVersionError( signature_version=resolved.get('signatureVersions'))
Example #6
Source File: client.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 6 votes |
def _resolve_signature_version(self, service_name, resolved): configured_version = _get_configured_signature_version( service_name, self.client_config, self.scoped_config) if configured_version is not None: return configured_version # Pick a signature version from the endpoint metadata if present. if 'signatureVersions' in resolved: potential_versions = resolved['signatureVersions'] if service_name == 's3': return 's3v4' if 'v4' in potential_versions: return 'v4' # Now just iterate over the signature versions in order until we # find the first one that is known to Botocore. for known in potential_versions: if known in AUTH_TYPE_MAPS: return known raise UnknownSignatureVersionError( signature_version=resolved.get('signatureVersions'))
Example #7
Source File: client.py From faces with GNU General Public License v2.0 | 5 votes |
def _resolve_signature_version(self, service_name, resolved): # Client config overrides everything. client = self.client_config if client and client.signature_version is not None: return client.signature_version # Scoped config overrides picking from the endpoint metadata. scoped = self.scoped_config if scoped is not None: service_config = scoped.get(service_name) if service_config is not None and isinstance(service_config, dict): version = service_config.get('signature_version') if version: logger.debug( "Switching signature version for service %s " "to version %s based on config file override.", service_name, version) return version # Pick a signature version from the endpoint metadata if present. if 'signatureVersions' in resolved: potential_versions = resolved['signatureVersions'] if service_name == 's3': # We currently prefer s3 over s3v4. if 's3' in potential_versions: return 's3' elif 's3v4' in potential_versions: return 's3v4' if 'v4' in potential_versions: return 'v4' # Now just iterate over the signature versions in order until we # find the first one that is known to Botocore. for known in AUTH_TYPE_MAPS: if known in potential_versions: return known raise UnknownSignatureVersionError( signature_version=resolved.get('signatureVersions'))
Example #8
Source File: client.py From faces with GNU General Public License v2.0 | 5 votes |
def _resolve_signature_version(self, service_name, resolved): # Client config overrides everything. client = self.client_config if client and client.signature_version is not None: return client.signature_version # Scoped config overrides picking from the endpoint metadata. scoped = self.scoped_config if scoped is not None: service_config = scoped.get(service_name) if service_config is not None and isinstance(service_config, dict): version = service_config.get('signature_version') if version: logger.debug( "Switching signature version for service %s " "to version %s based on config file override.", service_name, version) return version # Pick a signature version from the endpoint metadata if present. if 'signatureVersions' in resolved: potential_versions = resolved['signatureVersions'] if service_name == 's3': # We currently prefer s3 over s3v4. if 's3' in potential_versions: return 's3' elif 's3v4' in potential_versions: return 's3v4' if 'v4' in potential_versions: return 'v4' # Now just iterate over the signature versions in order until we # find the first one that is known to Botocore. for known in AUTH_TYPE_MAPS: if known in potential_versions: return known raise UnknownSignatureVersionError( signature_version=resolved.get('signatureVersions'))
Example #9
Source File: signers.py From bash-lambda-layer with MIT License | 4 votes |
def get_auth_instance(self, signing_name, region_name, signature_version=None, **kwargs): """ Get an auth instance which can be used to sign a request using the given signature version. :type signing_name: string :param signing_name: Service signing name. This is usually the same as the service name, but can differ. E.g. ``emr`` vs. ``elasticmapreduce``. :type region_name: string :param region_name: Name of the service region, e.g. ``us-east-1`` :type signature_version: string :param signature_version: Signature name like ``v4``. :rtype: :py:class:`~botocore.auth.BaseSigner` :return: Auth instance to sign a request. """ if signature_version is None: signature_version = self._signature_version cls = botocore.auth.AUTH_TYPE_MAPS.get(signature_version) if cls is None: raise UnknownSignatureVersionError( signature_version=signature_version) # If there's no credentials provided (i.e credentials is None), # then we'll pass a value of "None" over to the auth classes, # which already handle the cases where no credentials have # been provided. frozen_credentials = None if self._credentials is not None: frozen_credentials = self._credentials.get_frozen_credentials() kwargs['credentials'] = frozen_credentials if cls.REQUIRES_REGION: if self._region_name is None: raise botocore.exceptions.NoRegionError() kwargs['region_name'] = region_name kwargs['service_name'] = signing_name auth = cls(**kwargs) return auth # Alias get_auth for backwards compatibility.
Example #10
Source File: signers.py From aws-builders-fair-projects with Apache License 2.0 | 4 votes |
def get_auth_instance(self, signing_name, region_name, signature_version=None, **kwargs): """ Get an auth instance which can be used to sign a request using the given signature version. :type signing_name: string :param signing_name: Service signing name. This is usually the same as the service name, but can differ. E.g. ``emr`` vs. ``elasticmapreduce``. :type region_name: string :param region_name: Name of the service region, e.g. ``us-east-1`` :type signature_version: string :param signature_version: Signature name like ``v4``. :rtype: :py:class:`~botocore.auth.BaseSigner` :return: Auth instance to sign a request. """ if signature_version is None: signature_version = self._signature_version cls = botocore.auth.AUTH_TYPE_MAPS.get(signature_version) if cls is None: raise UnknownSignatureVersionError( signature_version=signature_version) # If there's no credentials provided (i.e credentials is None), # then we'll pass a value of "None" over to the auth classes, # which already handle the cases where no credentials have # been provided. frozen_credentials = None if self._credentials is not None: frozen_credentials = self._credentials.get_frozen_credentials() kwargs['credentials'] = frozen_credentials if cls.REQUIRES_REGION: if self._region_name is None: raise botocore.exceptions.NoRegionError() kwargs['region_name'] = region_name kwargs['service_name'] = signing_name auth = cls(**kwargs) return auth # Alias get_auth for backwards compatibility.
Example #11
Source File: signers.py From aws-extender with MIT License | 4 votes |
def get_auth_instance(self, signing_name, region_name, signature_version=None, **kwargs): """ Get an auth instance which can be used to sign a request using the given signature version. :type signing_name: string :param signing_name: Service signing name. This is usually the same as the service name, but can differ. E.g. ``emr`` vs. ``elasticmapreduce``. :type region_name: string :param region_name: Name of the service region, e.g. ``us-east-1`` :type signature_version: string :param signature_version: Signature name like ``v4``. :rtype: :py:class:`~botocore.auth.BaseSigner` :return: Auth instance to sign a request. """ if signature_version is None: signature_version = self._signature_version cls = botocore.auth.AUTH_TYPE_MAPS.get(signature_version) if cls is None: raise UnknownSignatureVersionError( signature_version=signature_version) # If there's no credentials provided (i.e credentials is None), # then we'll pass a value of "None" over to the auth classes, # which already handle the cases where no credentials have # been provided. frozen_credentials = None if self._credentials is not None: frozen_credentials = self._credentials.get_frozen_credentials() kwargs['credentials'] = frozen_credentials if cls.REQUIRES_REGION: if self._region_name is None: raise botocore.exceptions.NoRegionError() kwargs['region_name'] = region_name kwargs['service_name'] = signing_name auth = cls(**kwargs) return auth # Alias get_auth for backwards compatibility.
Example #12
Source File: signers.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 4 votes |
def get_auth_instance(self, signing_name, region_name, signature_version=None, **kwargs): """ Get an auth instance which can be used to sign a request using the given signature version. :type signing_name: string :param signing_name: Service signing name. This is usually the same as the service name, but can differ. E.g. ``emr`` vs. ``elasticmapreduce``. :type region_name: string :param region_name: Name of the service region, e.g. ``us-east-1`` :type signature_version: string :param signature_version: Signature name like ``v4``. :rtype: :py:class:`~botocore.auth.BaseSigner` :return: Auth instance to sign a request. """ if signature_version is None: signature_version = self._signature_version cls = botocore.auth.AUTH_TYPE_MAPS.get(signature_version) if cls is None: raise UnknownSignatureVersionError( signature_version=signature_version) # If there's no credentials provided (i.e credentials is None), # then we'll pass a value of "None" over to the auth classes, # which already handle the cases where no credentials have # been provided. frozen_credentials = None if self._credentials is not None: frozen_credentials = self._credentials.get_frozen_credentials() kwargs['credentials'] = frozen_credentials if cls.REQUIRES_REGION: if self._region_name is None: raise botocore.exceptions.NoRegionError() kwargs['region_name'] = region_name kwargs['service_name'] = signing_name auth = cls(**kwargs) return auth # Alias get_auth for backwards compatibility.
Example #13
Source File: signers.py From AWS-Transit-Gateway-Demo-MultiAccount with MIT License | 4 votes |
def get_auth_instance(self, signing_name, region_name, signature_version=None, **kwargs): """ Get an auth instance which can be used to sign a request using the given signature version. :type signing_name: string :param signing_name: Service signing name. This is usually the same as the service name, but can differ. E.g. ``emr`` vs. ``elasticmapreduce``. :type region_name: string :param region_name: Name of the service region, e.g. ``us-east-1`` :type signature_version: string :param signature_version: Signature name like ``v4``. :rtype: :py:class:`~botocore.auth.BaseSigner` :return: Auth instance to sign a request. """ if signature_version is None: signature_version = self._signature_version cls = botocore.auth.AUTH_TYPE_MAPS.get(signature_version) if cls is None: raise UnknownSignatureVersionError( signature_version=signature_version) # If there's no credentials provided (i.e credentials is None), # then we'll pass a value of "None" over to the auth classes, # which already handle the cases where no credentials have # been provided. frozen_credentials = None if self._credentials is not None: frozen_credentials = self._credentials.get_frozen_credentials() kwargs['credentials'] = frozen_credentials if cls.REQUIRES_REGION: if self._region_name is None: raise botocore.exceptions.NoRegionError() kwargs['region_name'] = region_name kwargs['service_name'] = signing_name auth = cls(**kwargs) return auth # Alias get_auth for backwards compatibility.
Example #14
Source File: signers.py From deepWordBug with Apache License 2.0 | 4 votes |
def get_auth_instance(self, signing_name, region_name, signature_version=None, **kwargs): """ Get an auth instance which can be used to sign a request using the given signature version. :type signing_name: string :param signing_name: Service signing name. This is usually the same as the service name, but can differ. E.g. ``emr`` vs. ``elasticmapreduce``. :type region_name: string :param region_name: Name of the service region, e.g. ``us-east-1`` :type signature_version: string :param signature_version: Signature name like ``v4``. :rtype: :py:class:`~botocore.auth.BaseSigner` :return: Auth instance to sign a request. """ if signature_version is None: signature_version = self._signature_version cls = botocore.auth.AUTH_TYPE_MAPS.get(signature_version) if cls is None: raise UnknownSignatureVersionError( signature_version=signature_version) # If there's no credentials provided (i.e credentials is None), # then we'll pass a value of "None" over to the auth classes, # which already handle the cases where no credentials have # been provided. frozen_credentials = None if self._credentials is not None: frozen_credentials = self._credentials.get_frozen_credentials() kwargs['credentials'] = frozen_credentials if cls.REQUIRES_REGION: if self._region_name is None: raise botocore.exceptions.NoRegionError() kwargs['region_name'] = region_name kwargs['service_name'] = signing_name auth = cls(**kwargs) return auth # Alias get_auth for backwards compatibility.
Example #15
Source File: signers.py From faces with GNU General Public License v2.0 | 4 votes |
def sign(self, operation_name, request, region_name=None, signing_type='standard', expires_in=None): """Sign a request before it goes out over the wire. :type operation_name: string :param operation_name: The name of the current operation, e.g. ``ListBuckets``. :type request: AWSRequest :param request: The request object to be sent over the wire. :type region_name: str :param region_name: The region to sign the request for. :type signing_type: str :param signing_type: The type of signing to perform. This can be one of three possible values: * 'standard' - This should be used for most requests. * 'presign-url' - This should be used when pre-signing a request. * 'presign-post' - This should be used when pre-signing an S3 post. :type expires_in: int :param expires_in: The number of seconds the presigned url is valid for. This parameter is only valid for signing type 'presign-url'. """ if region_name is None: region_name = self._region_name signature_version = self._choose_signer(operation_name, signing_type) # Allow mutating request before signing self._event_emitter.emit( 'before-sign.{0}.{1}'.format(self._service_name, operation_name), request=request, signing_name=self._signing_name, region_name=self._region_name, signature_version=signature_version, request_signer=self) if signature_version != botocore.UNSIGNED: kwargs = { 'signing_name': self._signing_name, 'region_name': region_name, 'signature_version': signature_version } if expires_in is not None: kwargs['expires'] = expires_in try: auth = self.get_auth_instance(**kwargs) except UnknownSignatureVersionError as e: if signing_type != 'standard': raise UnsupportedSignatureVersionError( signature_version=signature_version) else: raise e auth.add_auth(request)
Example #16
Source File: signers.py From faces with GNU General Public License v2.0 | 4 votes |
def get_auth_instance(self, signing_name, region_name, signature_version=None, **kwargs): """ Get an auth instance which can be used to sign a request using the given signature version. :type signing_name: string :param signing_name: Service signing name. This is usually the same as the service name, but can differ. E.g. ``emr`` vs. ``elasticmapreduce``. :type region_name: string :param region_name: Name of the service region, e.g. ``us-east-1`` :type signature_version: string :param signature_version: Signature name like ``v4``. :rtype: :py:class:`~botocore.auth.BaseSigner` :return: Auth instance to sign a request. """ if signature_version is None: signature_version = self._signature_version cls = botocore.auth.AUTH_TYPE_MAPS.get(signature_version) if cls is None: raise UnknownSignatureVersionError( signature_version=signature_version) # If there's no credentials provided (i.e credentials is None), # then we'll pass a value of "None" over to the auth classes, # which already handle the cases where no credentials have # been provided. frozen_credentials = None if self._credentials is not None: frozen_credentials = self._credentials.get_frozen_credentials() kwargs['credentials'] = frozen_credentials if cls.REQUIRES_REGION: if self._region_name is None: raise botocore.exceptions.NoRegionError() kwargs['region_name'] = region_name kwargs['service_name'] = signing_name auth = cls(**kwargs) return auth # Alias get_auth for backwards compatibility.
Example #17
Source File: signers.py From faces with GNU General Public License v2.0 | 4 votes |
def sign(self, operation_name, request, region_name=None, signing_type='standard', expires_in=None): """Sign a request before it goes out over the wire. :type operation_name: string :param operation_name: The name of the current operation, e.g. ``ListBuckets``. :type request: AWSRequest :param request: The request object to be sent over the wire. :type region_name: str :param region_name: The region to sign the request for. :type signing_type: str :param signing_type: The type of signing to perform. This can be one of three possible values: * 'standard' - This should be used for most requests. * 'presign-url' - This should be used when pre-signing a request. * 'presign-post' - This should be used when pre-signing an S3 post. :type expires_in: int :param expires_in: The number of seconds the presigned url is valid for. This parameter is only valid for signing type 'presign-url'. """ if region_name is None: region_name = self._region_name signature_version = self._choose_signer(operation_name, signing_type) # Allow mutating request before signing self._event_emitter.emit( 'before-sign.{0}.{1}'.format(self._service_name, operation_name), request=request, signing_name=self._signing_name, region_name=self._region_name, signature_version=signature_version, request_signer=self) if signature_version != botocore.UNSIGNED: kwargs = { 'signing_name': self._signing_name, 'region_name': region_name, 'signature_version': signature_version } if expires_in is not None: kwargs['expires'] = expires_in try: auth = self.get_auth_instance(**kwargs) except UnknownSignatureVersionError as e: if signing_type != 'standard': raise UnsupportedSignatureVersionError( signature_version=signature_version) else: raise e auth.add_auth(request)