Git Product home page Git Product logo

nagyistge / 3scale_ws_api_for_python Goto Github PK

View Code? Open in Web Editor NEW

This project forked from 3scale-labs/3scale_ws_api_for_python

0.0 2.0 0.0 72 KB

3scale integration plugin for Python applications. 3scale is an API Infrastructure service which handles API Keys, Rate Limiting, Analytics, Billing Payments and Developer Management. Includes a configurable API dashboard and developer portal CMS. More product stuff at http://www.3scale.net/, support information at http://support.3scale.net/.

Home Page: www.3scale.net

License: MIT License

Python 100.00%

3scale_ws_api_for_python's Introduction

Client for 3scale web service management system API Build Status

3scale integration plugin for Python applications. 3scale is an API Infrastructure service which handles API Keys, Rate Limiting, Analytics, Billing Payments and Developer Management. Includes a configurable API dashboard and developer portal CMS. More product stuff at http://www.3scale.net/, support information at http://support.3scale.net/.

Installation:

Standard distutils installation: unpack ThreeScale-2.0.tar.gz, and from ThreeScale-2.0 directory run

sudo python setup.py install

or you may put ThreeScalePY.py to the same directory as your program

libxml2 is required, if you are unable to install (as in Google AppEngine), please use the ElementTree branch.

Usage:

AuthRep, the recommended approach:

Doing an authrep for the AppId or OAuth authenthication patterns is as follows:

import ThreeScalePY
authrep = ThreeScalePY.ThreeScaleAuthRep(provider_key, app_id, app_key)
if authrep.authrep():
    # all was ok, proceed normally
else: # something was wrong
    sys.stdout.write(" reason = %s \n" % authrep.build_response().get_reason())

if you are using the UserKey auth pattern do this:

import ThreeScalePY
authrep = ThreeScalePY.ThreeScaleAuthRepUserKey(provider_key, user_key)
if authrep.authrep():
    # all was ok, proceed normally
else: # something was wrong
    sys.stdout.write(" reason = %s \n" % authrep.build_response().get_reason())

These examples are doing a default authrep call to the metric 'hits' with usage 1, you can pass several metrics by doing:

authrep.authrep({"hits": 10, "metric1": 12, ...}):

check the implementation and authrep's active docs for more parameters.

Authorize transactions:

ThreeScalePY.ThreeScaleAuthorize("provider key", "app id", "app key").authorize()

ThreeScalePY.ThreeScaleAuthorizeUserKey("provider key", None, None, "user key").authorize()

Report transactions:

ThreeScalePY.ThreeScaleReport("provider key").report([{"app_id":"app id", "usage":{"hits":1, "max_value":5}}]

OR

ThreeScalePY.ThreeScaleReport("provider key").report([{"user_key":"user key", "usage":{"hits":1, "max_value":5}}]

3scale_ws_api_for_python's People

Contributors

aurelian avatar hafizur-rahman avatar joahking avatar mikz avatar solso avatar tmacedo avatar vdel26 avatar

Watchers

 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.