Add verify example

pull/1/head
Andrey Kislyuk 2017-08-22 12:59:35 -07:00
parent d37125f0a6
commit 59384e29b9
2 changed files with 9 additions and 0 deletions

View File

@ -15,6 +15,14 @@ dependency on `cryptography <https://pypi.python.org/pypi/cryptography>`_.
url = 'http://httpbin.org/get'
requests.get(url, auth=HTTPSignatureAuth(key=preshared_secret))
In addition to signing messages in the client, this module can be used to verify incoming requests:
.. code-block:: python
def key_resolver(key_id, algorithm):
return 'monorail_cat'
HTTPSignatureAuth(key=preshared_secret).verify(request, key_resolver=key_resolver)
Installation
------------

View File

@ -2,6 +2,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera
import base64, hashlib, hmac, time
import email.utils
import requests
from requests.compat import urlparse