Skip to main content

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. Using Python-Requests, RestMapper will parse JSON and display responses nicely, based on a declarative format you provide for each API you integrate with (in progress).


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


The first thing you need to do is generate a base RestMapper object that will allow you to instantiate a connection with a remote API.

>>> Twitter = RestMapper("", url_transformer=lambda url: url + ".json")

The next step is to provide authentication. For Twitter, you’ll need to provide OAuth1 credentials (for other APIs, any other requests-compatible auth object will do):

>>> from requests_oauthlib import OAuth1
>>> twitter = Twitter(auth=auth)

And start making calls. The API object is declarative, meaning that attributes and properties map 1-1 with the API you’re integrating with. I.e., the below:

>>> response = twitter.statuses.mentions_timeline()

…will request Notice the url_transformer object used above—this adds “.json” to any request. You can pass in any function into the url_transformer object to handle more complicated situations.

If you want to pass in body data for a POST, provide a single argument to the call to the API, and specify “POST” as the first attribute. I.e.


PATCH, PUT, GET, and POST are all supported (more will come later). GET is currently the default.


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 as an argument to the API object.


If you like this library, or need help implementing it, send us an email:


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.

Files for restmapper, version 0.0.5
Filename, size File type Python version Upload date Hashes
Filename, size restmapper-0.0.5.tar.gz (4.2 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page