Esempio n. 1
0
 def put_with_digest(self, url, request_params, secret, error_on_failure=False):
     """
     Put to a url with the Message Authentication Digest
     :type url: str
     :type request_params: dict [str, any]
     :param secret: the secret used to produce the message auth digest
     :rtype: requests.Response
     """
     encoded_body = self.encode_body(request_params)
     return self.put(url, encoded_body, headers=Secret.header(encoded_body, secret),
                     error_on_failure=error_on_failure)
Esempio n. 2
0
 def put_with_digest(self,
                     url,
                     request_params,
                     secret,
                     error_on_failure=False):
     """
     Put to a url with the Message Authentication Digest
     :type url: str
     :type request_params: dict [str, any]
     :param secret: the secret used to produce the message auth digest
     :rtype: requests.Response
     """
     encoded_body = self.encode_body(request_params)
     return self.put(url,
                     encoded_body,
                     headers=Secret.header(encoded_body, secret),
                     error_on_failure=error_on_failure)
Esempio n. 3
0
 def test_header_generates_128_character_digest(self):
     secret = hashlib.sha512().hexdigest()
     header = Secret.header('message', secret)
     self.assertEqual(len(header[Secret.DIGEST_HEADER_KEY]), 128)
Esempio n. 4
0
 def test_header_generates_128_character_digest(self):
     secret = hashlib.sha512().hexdigest()
     header = Secret.header('message', secret)
     self.assertEqual(len(header[Secret.DIGEST_HEADER_KEY]), 128)