parameters: (self, *args, **kwargs)
docstring: AWS4Auth instances can be created by supplying key scope parameters
          directly or by using an AWS4SigningKey instance:
  
          >>> auth = AWS4Auth(access_id, secret_key, region, service
          ...                 [, date][, raise_invalid_date=False][, session_token=None])
  
            or
  
          >>> auth = AWS4Auth(access_id, signing_key[, raise_invalid_date=False])
  
          access_id   -- This is your AWS access ID
          secret_key  -- This is your AWS secret access key
          region      -- The region you're connecting to, as per the list at
                         http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
                         e.g. us-east-1. For services which don't require a region
                         (e.g. IAM), use us-east-1.
          service     -- The name of the service you're connecting to, as per
                         endpoints at:
                         http://docs.aws.amazon.com/general/latest/gr/rande.html
                         e.g. elasticbeanstalk.
          date        -- Date this instance is valid for. 8-digit date as str of the
                         form YYYYMMDD. Key is only valid for requests with a
                         Date or X-Amz-Date header matching this date. If date is
                         not supplied the current date is used.
          signing_key -- An AWS4SigningKey instance.
          raise_invalid_date
                      -- Must be supplied as keyword argument. AWS4Auth tries to
                         parse a date from the X-Amz-Date and Date headers of the
                         request, first trying X-Amz-Date, and then Date if
                         X-Amz-Date is not present or is in an unrecognised
                         format. If one or both of the two headers are present
                         yet neither are in a format which AWS4Auth recognises
                         then it will remove both headers and replace with a new
                         X-Amz-Date header using the current date.
  
                         If this behaviour is not wanted, set the
                         raise_invalid_date keyword argument to True, and
                         instead an InvalidDateError will be raised when neither
                         date is recognised. If neither header is present at all
                         then an X-Amz-Date header will still be added containing
                         the current date.
  
                         See the AWS4Auth class docstring for supported date
                         formats.
          session_token
                      -- Must be supplied as keyword argument. If session_token
                         is set, then it is used for the x-amz-security-token
                         header, for use with STS temporary credentials.
docstring_summary: AWS4Auth instances can be created by supplying key scope parameters
          directly or by using an AWS4SigningKey instance:
docstring_tokens: AWS4Auth instances can be created by supplying key scope parameters directly or by using an AWS4SigningKey instance :
function: def __init__(self, *args, **kwargs):
          """
          AWS4Auth instances can be created by supplying key scope parameters
          directly or by using an AWS4SigningKey instance:
  
          >>> auth = AWS4Auth(access_id, secret_key, region, service
          ...                 [, date][, raise_invalid_date=False][, session_token=None])
  
            or
  
          >>> auth = AWS4Auth(access_id, signing_key[, raise_invalid_date=False])
  
          access_id   -- This is your AWS access ID
          secret_key  -- This is your AWS secret access key
          region      -- The region you're connecting to, as per the list at
                         http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region
                         e.g. us-east-1. For services which don't require a region
                         (e.g. IAM), use us-east-1.
          service     -- The name of the service you're connecting to, as per
                         endpoints at:
                         http://docs.aws.amazon.com/general/latest/gr/rande.html
                         e.g. elasticbeanstalk.
          date        -- Date this instance is valid for. 8-digit date as str of the
                         form YYYYMMDD. Key is only valid for requests with a
                         Date or X-Amz-Date header matching this date. If date is
                         not supplied the current date is used.
          signing_key -- An AWS4SigningKey instance.
          raise_invalid_date
                      -- Must be supplied as keyword argument. AWS4Auth tries to
                         parse a date from the X-Amz-Date and Date headers of the
                         request, first trying X-Amz-Date, and then Date if
                         X-Amz-Date is not present or is in an unrecognised
                         format. If one or both of the two headers are present
                         yet neither are in a format which AWS4Auth recognises
                         then it will remove both headers and replace with a new
                         X-Amz-Date header using the current date.
  
                         If this behaviour is not wanted, set the
                         raise_invalid_date keyword argument to True, and
                         instead an InvalidDateError will be raised when neither
                         date is recognised. If neither header is present at all
                         then an X-Amz-Date header will still be added containing
                         the current date.
  
                         See the AWS4Auth class docstring for supported date
                         formats.
          session_token
                      -- Must be supplied as keyword argument. If session_token
                         is set, then it is used for the x-amz-security-token
                         header, for use with STS temporary credentials.
  
          """
          l = len(args)
          if l not in [2, 4, 5]:
              msg = 'AWS4Auth() takes 2, 4 or 5 arguments, {} given'.format(l)
              raise TypeError(msg)
          self.access_id = args[0]
          if isinstance(args[1], AWS4SigningKey) and l == 2:
              # instantiate from signing key
              self.signing_key = args[1]
              self.region = self.signing_key.region
              self.service = self.signing_key.service
              self.date = self.signing_key.date
          elif l in [4, 5]:
              # instantiate from args
              secret_key = args[1]
              self.region = args[2]
              self.service = args[3]
              self.date = args[4] if l == 5 else None
              self.signing_key = None
              self.regenerate_signing_key(secret_key=secret_key)
          else:
              raise TypeError()
  
          raise_invalid_date = kwargs.get('raise_invalid_date', False)
          if raise_invalid_date in [True, False]:
              self.raise_invalid_date = raise_invalid_date
          else:
              raise ValueError('raise_invalid_date must be True or False in AWS4Auth.__init__()')
  
          self.session_token = kwargs.get('session_token')
          if self.session_token:
              self.default_include_headers.append('x-amz-security-token')
          self.include_hdrs = kwargs.get('include_hdrs',
                                         self.default_include_headers)
          AuthBase.__init__(self)
function_tokens: def __init__ ( self , * args , * * kwargs ) : l = len ( args ) if l not in [ 2 , 4 , 5 ] : msg = 'AWS4Auth() takes 2, 4 or 5 arguments, {} given' . format ( l ) raise TypeError ( msg ) self . access_id = args [ 0 ] if isinstance ( args [ 1 ] , AWS4SigningKey ) and l == 2 : # instantiate from signing key self . signing_key = args [ 1 ] self . region = self . signing_key . region self . service = self . signing_key . service self . date = self . signing_key . date elif l in [ 4 , 5 ] : # instantiate from args secret_key = args [ 1 ] self . region = args [ 2 ] self . service = args [ 3 ] self . date = args [ 4 ] if l == 5 else None self . signing_key = None self . regenerate_signing_key ( secret_key = secret_key ) else : raise TypeError ( ) raise_invalid_date = kwargs . get ( 'raise_invalid_date' , False ) if raise_invalid_date in [ True , False ] : self . raise_invalid_date = raise_invalid_date else : raise ValueError ( 'raise_invalid_date must be True or False in AWS4Auth.__init__()' ) self . session_token = kwargs . get ( 'session_token' ) if self . session_token : self . default_include_headers . append ( 'x-amz-security-token' ) self . include_hdrs = kwargs . get ( 'include_hdrs' , self . default_include_headers ) AuthBase . __init__ ( self )