https://github.com/stavxyz/requests-chef
Chef auth support for Python-Requests
https://github.com/stavxyz/requests-chef
Last synced: about 2 months ago
JSON representation
Chef auth support for Python-Requests
- Host: GitHub
- URL: https://github.com/stavxyz/requests-chef
- Owner: stavxyz
- License: apache-2.0
- Created: 2015-06-27T19:35:18.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2023-02-08T22:29:25.000Z (over 2 years ago)
- Last Synced: 2025-03-14T12:16:27.525Z (3 months ago)
- Language: Python
- Homepage:
- Size: 92.8 KB
- Stars: 4
- Watchers: 2
- Forks: 3
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# requests-chef
[](https://pypi.python.org/pypi/requests-chef)
[](https://circleci.com/gh/samstav/requests-chef)
[](https://coveralls.io/r/samstav/requests-chef)
[](https://requires.io/github/samstav/requests-chef/requirements/?branch=master)
##### [Chef auth](https://docs.chef.io/auth.html#authentication-headers) support for [Python-Requests](http://docs.python-requests.org/en/latest/)```python
import requests
import requests_chefauth = requests_chef.ChefAuth('chef-user', '~/chef-user.pem')
response = requests.get('https://api.chef.io/users/chef-user',
headers={'X-Chef-Version': '12.0.2'},
auth=auth)
response.json()
...
{'display_name': 'chef-user',
'email': '[email protected]',
'first_name': 'Chef',
'last_name': 'User',
'middle_name': '',
'public_key': '-----BEGIN PUBLIC KEY-----\nMIIBIj...IDAQAB\n-----END PUBLIC KEY-----\n',
'username': 'chef-user'}
```
See [samstav/okchef](https://github.com/samstav/okchef) first, since thats generally more useful. [`okchef`](https://github.com/samstav/okchef) uses [`requests-chef`](https://github.com/samstav/requests-chef) to sign and authenticate requests.
### InstallThis project currently requires [a fork](https://github.com/samstav/cryptography/tree/rsa-bypass-hash-on-signer) of [pyca/cryptography](https://github.com/pyca/cryptography) due to the following related issues:
* [#1648: decouple hashing process from signature generation / verification](https://github.com/pyca/cryptography/issues/1648)
* [#1579: Support asymmetric signing with pre-computed digest](https://github.com/pyca/cryptography/issues/1579)##### Instructions
*First*, install this fork of cryptography directly from github.
```
$ pip install git+https://github.com/samstav/cryptography.git@rsa-bypass-hash-on-signer
```If you don't do this first, you'd have to use the (deprecated, scheduled for removal) `--process-dependency-links` option through pip, since pip no longer respects [dependency links](https://pythonhosted.org/setuptools/setuptools.html#dependencies-that-aren-t-in-pypi) by default (as of pip 1.5).
```
$ pip install --process-dependency-links requests-chef
```