Skip to main content

Object Oriented rest client

Project description

# RESTler

Status: [![Travis Status](](

RESTler is a python library I dreamed up that maps Object+method calls to RESTful
URL requests. The idea is that you create a base RESTler object for the root of the
RESTful web application and then use method calls to get sub URLs and then use some
keyword attributes to make various requests to the created route, with built in
response handling. This should make it easy to wrap a nice RESTful API into a
simple python library.

## Example

``` python
>> flickr = Restler('')
>> photos =
>> photos.__url__

## Getting Started

If you have a RESTful API you want to wrap, just use the `Restler` constructor to
create the base entry point of the application. Then use the resulting object to
access the sub-routes of the application. Every attribute maps to a level of the
URL, so `application.users.asdf` would request from `(application base)/users/asdf/`

## Route Object

The `Route` object returned from each attribute of the route has a series of
methods to help in accessing the current route or child routes. The object itself
is calleable which maps to a `GET` request on the object. Any other attributes will
map to sub URLs of the current URL the `Route` maps to.

## Response Object

Any request made via a `Route` will return a `Response` object. This object will
encapsulate the basic request with some helpers built in. The main helper is that
the object's representation will map to the clearest form of the response data. If
this is a JSON string, it will be parsed, if it is an XML document, it will be a
pointer to the XML document, if it is a plaintext string, it will just be a plain
string. The headers for the response will be accessible as well via a reserved
property of the response.

### Example

``` python
workhammer = Restler('')
login = workhammer.login("post", username='admin', password='password')
if login.code > 300:
throw "Login failed"

players = workhammer.player()
player = workhammer.player[players[0].id]()

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

librestler-0.2.2.tar.gz (8.6 kB view hashes)

Uploaded source

Built Distribution

librestler-0.2.2-py2-none-any.whl (12.6 kB view hashes)

Uploaded 2 7

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page