Beispiel #1
0
 def headers_to_sign(self, request):
     """
     Select the headers from the request that need to be included
     in the StringToSign.
     """
     header_map = HTTPHeaders()
     split = urlsplit(request.url)
     for name, value in request.headers.items():
         lname = name.lower()
         if lname not in SIGNED_HEADERS_BLACKLIST:
             header_map[lname] = value
     if 'host' not in header_map:
         header_map['host'] = split.netloc
     return header_map
Beispiel #2
0
 def __init__(self, *args, **kwargs):
     self.auth_path = None
     if 'auth_path' in kwargs:
         self.auth_path = kwargs['auth_path']
         del kwargs['auth_path']
     models.Request.__init__(self, *args, **kwargs)
     headers = HTTPHeaders()
     if self.headers is not None:
         for key, value in self.headers.items():
             headers[key] = value
     self.headers = headers
     # This is a dictionary to hold information that is used when
     # processing the request. What is inside of ``context`` is open-ended.
     # For example, it may have a timestamp key that is used for holding
     # what the timestamp is when signing the request. Note that none
     # of the information that is inside of ``context`` is directly
     # sent over the wire; the information is only used to assist in
     # creating what is sent over the wire.
     self.context = {}