A Python wrapper for restmapper
Project description
python-restmapper is a tool that makes writing RESTful API clients a breeze. It removes all of the complexity with writing API-specific code, and lets you focus all your energy on the important stuff. Restmapper will even parse JSON and XML objects and display them nicely, based on a declarative format you provide for each API you integrate with.
Installation
python-restmapper is available for download through the Python Package Index (PyPi). You can install it right away using pip or easy_install.
pip install restmapper
No dependencies (besides Python 2.7).
Usage
The first thing you need to do is generate a base RestMapper object that will allow you to instantiate a connection a remote API with authentication.
>>> from requests_oauthlib import OAuth1
>>> Twitter = RestMapper("https://api.twitter.com/1.1/", url_transformer=lambda url: url + ".json")
Now, just get an access key and secret, and then start making calls with the API object.
>>> auth = OAuth1('YOUR_APP_KEY', 'YOUR_APP_SECRET', 'USER_OAUTH_TOKEN', 'USER_OAUTH_TOKEN_SECRET')
>>> twitter = Twitter(auth=auth)
>>> response = twitter.statuses.mentions_timeline()
Miscellaneous
By default, python-restmapper will return parsed JSON objects. If you’d like the raw response object for a request, just pass in parse_response=False.
>>> response = ...
... your org ...
Support
If you like this library, or need help implementing it, send us an email: hi@lionheartsw.com.
License
Apache License, Version 2.0. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.