This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!

Client for Django-Tastypie based REST services

Project Description

Tastypie-client is a client API for Django-Tastypie REST services.

Quick start

These examples work on the tastypie_tutorial Django project.

Create an Api object

>>> from tastypie_client import Api
>>> api = Api('http://127.0.0.1:8000/api/1/')
>>> api
<Api: http://127.0.0.1:8000/api/1/>

Finds an user by its ID

>>> api.user
<EndpointProxy http://127.0.0.1:8000/api/1/user/>
>>> user = api.user(1)
>>> user
<Resource user/1: {u'username': u'test_user', ...}>
>>> user.username
u'test_user'

Look at its posts

>>> user.posts
[u'/api/1/entry/1/', u'/api/1/entry/2/']

Get the first one

>>> user.posts[0]
Resource entry/1: {u'body': u'foo body', u'title': u'foo!', u'id': u'1', u'user': <ResourceProxy user/1>, u'pub_date': u'2012-04-29T08:55:08', u'slug': u'foo'}>

Alternatively, you load both of them with an unique HTTP request

>>> user.posts[:]
[<Resource entry/1: {u'body': u'foo body', u'title': u'foo!', u'id': u'1', u'user': <ResourceProxy user/1>, u'pub_date': u'2012-04-29T08:55:08', u'slug': u'foo'}>,
 <Resource entry/2: {u'body': u'bar body', u'title': u'bar title', u'id': u'2', u'user': <ResourceProxy user/1>, u'pub_date': u'2012-04-29T08:55:21', u'slug': u'bar'}>]
Release History

Release History

This version
History Node

0.1.0

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
tastypie-client-0.1.0.tar.gz (8.9 kB) Copy SHA256 Checksum SHA256 Source Apr 29, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting