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


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("{path}.json")

{path} is just a placeholder for the rest of the path. You’ll specify this later when making API calls.

Twitter’s API is protected by OAuth1, so the next step is to provide authentication. When integrating with any other API, any requests-compatible auth object can be provided.

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

Now you can start making calls. The API object’s attributes and properties map one-to-one with the API you’re integrating with. E.g., the below:

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

…will request The path implied by the attribute syntax is inserted right where the path placeholder is in the Twitter object’s instantiation earlier.

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. 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 1.0.0
Filename, size File type Python version Upload date Hashes
Filename, size restmapper-1.0.0.tar.gz (4.6 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