An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

        

# requests-chef
[![latest](https://img.shields.io/pypi/v/requests-chef.svg)](https://pypi.python.org/pypi/requests-chef)
[![Circle CI](https://circleci.com/gh/samstav/requests-chef/tree/master.svg?style=shield)](https://circleci.com/gh/samstav/requests-chef)
[![Coverage Status](https://coveralls.io/repos/samstav/requests-chef/badge.svg)](https://coveralls.io/r/samstav/requests-chef)
[![Requirements Status](https://requires.io/github/samstav/requests-chef/requirements.svg?branch=master)](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_chef

auth = 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.
### Install

This 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
```