Giter VIP home page Giter VIP logo

resigner's Introduction

travis ci

Resigner doc

What it does

Signes API requests: each client is identified by its key and granted access by a secret. (no secret transmitted over to server - used only to sign a request)

How to install

pip install git+git://github.com/mediapredict/resigner.git

Configuration

In settings.py:

INSTALLED_APPS = (
    ...
    'resigner',
    ...
)

Optional

RESIGNER_API_MAX_DELAY = 30 # max delay in seconds (default 5*60 seconds)

Usage (in progress)

Server

from django.http import JsonResponse

from resigner.server import signed_req_required

@signed_req_required
def my_api_view(request):
    resp = {"result": "this API has been protected with secret key"}
    return JsonResponse(resp)

Add through admin:

  • in ApiKeys: MY_API_KEY (key, used to identify a client) and my_secret_key (secret, used to get access)

You may use auto generated or provide specific value.

Client

...
res = post_signed(
    "http://mysite/api_url", {"some": "data_we_want_to_transmit"}, "my_client_key", "my_secret_key"
)

if res.status_code == 200:
    print "went good!"
else:
    print "error HTTP status_code:{0}".format(res.status_code)
...

Make sure MY_API_KEY and MY_TEST_CLIENT have been added in the server's DB as explained above.

resigner's People

Contributors

igorkramaric avatar jiaaro avatar

Watchers

 avatar 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.