requests-hawk
Project description
This project allows you to use the python requests library with the hawk authentication mechanism.
Hawk itself does not provide any mechanism for obtaining or transmitting the set of shared credentials required, but this project proposes the following scheme (that we use accross mozilla services projects).
Great, how can I use it?
First, you’ll need to install it:
pip install requests-hawk
Then, in your project, you can use it like that:
import requests from requests_hawk import HawkAuth hawk_auth = HawkAuth( hawk_session=resp.headers['hawk-session-token'], server_url=self.server_url ) requests.post("/url", auth=hawk_auth)
Integration with httpie
Httpie is a tool which lets you do requests to a distant server in a nice and easy way. Under the hood, httpie uses the requests library. We’ve made it simple for you to plug hawk with it.
If you know the id and key, use it like that:
http POST localhost:5000/registration\ --auth-type=hawk --auth='id:key'
Or, if you want to use the hawk session token, you can do as follows:
http POST localhost:5000/registration\ --auth-type=hawk --auth='c0d8cd2ec579a3599bef60f060412f01f5dc46f90465f42b5c47467481315f51:'
Take care, don’t forgot to add the extra : at the end of the hawk session token for it to be considered like so.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file requests-hawk-0.1.0.tar.gz
.
File metadata
- Download URL: requests-hawk-0.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d707471984ca81054f518ac20811353a959a02f4701fe48b7dbaa114e3c5bacb |
|
MD5 | 47f7e1e3298feda388a4d175e2510152 |
|
BLAKE2b-256 | 8342da052293f683320409dbf5f5686505b4ac9fd1173a84456c38002246fb0e |