Skip to main content

A Python wrapper for restmapper

Project description

civersiondownloads

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

http://img.shields.io/pypi/l/restmapper.svg?style=flat

Apache License, Version 2.0. See LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

restmapper-0.0.2.tar.gz (3.8 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page