Code Monkey home page Code Monkey logo

python-hmac-auth's Introduction

python-hmac-auth

HMAC authentication for Python client libraries.

This library makes it easy to add support for HMAC authentication in Python clients that:

  1. Interface with a REST API that uses jersey-hmac-auth to implement HMAC authentication, and
  2. Use the Python Requests library to make API calls.

It works by providing a custom authenticator for the Requests library that modifies outgoing API calls to encode the requests for HMAC authentication.

Getting Started

To install:

pip install python-hmac-auth

In your code, import the HmacAuth class and specify it on the auth parameter when issuing API calls:

import requests
from python_hmac_auth import HmacAuth

response = requests.get('http://example.com/api', auth=HmacAuth('your_api_key', 'your_secret_key'))

If you need to you can adjust the names of the query parameter and headers used by HMAC by passing values for:

  • api_key_query_param
  • signature_http_header
  • timestamp_http_header
  • version_http_header to the constructor as named parameters.

See the User Guide to find the default names for these headers.

Changes in the client must also be made at the server or authentication will not work.

User Guide

See the User Guide for jersey-hmac-auth for more details about HMAC authentication on the server and for clients libraries.

Contributing

To get the code:

$ git clone [email protected]:bazaarvoice/python-hmac-auth.git

To submit a new request or issue, please visit the Issues page.

Pull requests are always welcome.

python-hmac-auth's People

Contributors

bentonporter avatar jsurls avatar juddrogers avatar matthewfitch23 avatar reason-bv avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.