Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

108 lines (71 sloc) 2.774 kb

restfulie-py

One minute tutorial
Hypermedia Implementation
Client
Examples
Hypermedia Examples
OpenSearch Examples

Introduction

This is a one minute guide to get you going with Restfulie Python
We are ready to go, hypermedia supported:

from restfulie import Restfulie

# using restfulie as an http api:
>>> response = Restfulie.at('http://localhost:8080/items').accepts('application/xml').get()
>>> print response.body
<items>
    <item>
        <name>Car</name>
        <price>32000.00</price>
    </item>
    <item>
        <name>House</name>
        <price>231000.00</price>
    </item>
</items>

>>> print response.code
200

# unmarshalling the items response
>>> r = response.resource()
>>> print len(r.item)
2
>>> print len(r.item[0].name)
Car

# navigating through hypermedia
# using kwargs as request parameters
>>> result = items.link("self").follow().post(name='New product', price=30)

# or, using a dict as request parameters
>>> parameters = {"name":"New product", "price":30}
>>> result = items.link("self").follow().post(**parameters)

>>> print result.code
200

This is it. Adding hypermedia capabilities and following links. Now its time to use it in the right way.

Installing Restfulie

On project root, run:

$ python setup.py install

If you like to install from pip, run:

pip install restfulie

Or with easy_install:

easy_install restfulie

Installing Restfulie for development

First, create your Makefile based on Makefile.example.

Then, make the installation:

$ make dev

The required dependencies should be installed automatically.

Running tests

On project root, run:

$ make test

To run restfulie-restbuy integration test, first start restfulie-restbuy server and run:

$ python setup.py nosetests -i "spec|should"

Team

Alexandre Atoji
Andrew Toshiaki Nakayama Kurauchi
BecaMotta
Douglas Camata
Guilherme Silveira
Hugo Lopes Tavares
Marianna Reis
Pedro Matiello
Rodrigo Manhães
Tarsis Azevedo

Jump to Line
Something went wrong with that request. Please try again.