Python

NetDNA REST Web Services Python Client

Please make sure you have request & certifi installed:

$ sudo pip install requests
$ sudo pip install certifi

Installation

$ sudo pip install netdnarws

Usage

from netdnarws import NetDNA
api = NetDNA("myalias", "consumer_key", "consumer_secret")
api.get("/account.json")

Methods

It has support for GET, POST, PUT and DELETE OAuth signed requests.

Every request can take an optional debug parameter.

api.get("/account.json", debug=True)
# Will output
# Making GET request to http://rws.netdna.com/myalias/account.json
#{... API Returned Stuff ...}

For more information about what optional parameters this methods accept you should check out @kennethreitz library Requests.

Initialization

For applications that don't require user authentication, you can use the default initialization as the example above.

For applications that require user authentication, you can initialize the API as follows.

api = NetDNA("myalias", "consumer_key", "consumer_secret",
             token="user_token", token_secret="user_token_secret")

You can also send the optional parameter header_auth, which takes a boolean to send the OAuth header in the body or URLEncoded.