Skip to main content

Chef Authentication protocol support for Python-Requests

Project description

requests-chef
=============

| |latest|
| |Circle CI|
| |Coverage Status|
| |Requirements Status|

`Chef auth <https://docs.chef.io/auth.html#authentication-headers>`__ support for `Python-Requests <http://docs.python-requests.org/en/latest/>`__
--------------------------------------------------------------------------------------------------------------------------------------------------

.. code:: python

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': 'chef-user@example.com',
'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

.. raw:: html

<!--Convert this file to .rst: `pandoc --from=markdown_github --to=rst README.md --output=README.rst` -->

.. |latest| image:: https://img.shields.io/pypi/v/requests-chef.svg
:target: https://pypi-hypernode.com/pypi/requests-chef
.. |Circle CI| image:: https://circleci.com/gh/samstav/requests-chef/tree/master.svg?style=shield
:target: https://circleci.com/gh/samstav/requests-chef
.. |Coverage Status| image:: https://coveralls.io/repos/samstav/requests-chef/badge.svg
:target: https://coveralls.io/r/samstav/requests-chef
.. |Requirements Status| image:: https://requires.io/github/samstav/requests-chef/requirements.svg?branch=master
:target: https://requires.io/github/samstav/requests-chef/requirements/?branch=master

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

requests-chef-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

File details

Details for the file requests-chef-0.1.0.tar.gz.

File metadata

File hashes

Hashes for requests-chef-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5cba08db7b091a8d4a2005b4e68248ef23dd3bba69a0286de4478c6ef0a96c3a
MD5 a077c4d8e4a3dbf834e6412818a3f61a
BLAKE2b-256 7cb42a68135a3bb827b29baa7a5dfb4ae5fd624d74020f2ffbea4f19550a9bab

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page