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.1.tar.gz (5.6 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for requests-chef-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c46e97d2d660d6d8cde6547411135af0bc208e60b4fb02b8d6e0bb9c829e5d20
MD5 1cee9290fad7f4aa8d240b9278c67507
BLAKE2b-256 d7f4eaf594fc33913c684892aba6b96ec64804f5b399b5323c990ad7194cb06f

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