Add verify example
parent
d37125f0a6
commit
59384e29b9
|
@ -15,6 +15,14 @@ dependency on `cryptography <https://pypi.python.org/pypi/cryptography>`_.
|
||||||
url = 'http://httpbin.org/get'
|
url = 'http://httpbin.org/get'
|
||||||
requests.get(url, auth=HTTPSignatureAuth(key=preshared_secret))
|
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
|
Installation
|
||||||
------------
|
------------
|
||||||
|
|
|
@ -2,6 +2,7 @@ from __future__ import absolute_import, division, print_function, unicode_litera
|
||||||
|
|
||||||
import base64, hashlib, hmac, time
|
import base64, hashlib, hmac, time
|
||||||
import email.utils
|
import email.utils
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
from requests.compat import urlparse
|
from requests.compat import urlparse
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue