Skip to main content

Client for Tastypie. Provide operation similar to the Django Model API

Project description

Tastypie Queryset Client

Client for Tastypie. Provide operation similar to the Django Model API .

Usage

Get

>>> client = Client("http://api.server.com/your/v1/")
>>> client.your.objects.get(name="your")
<your: {u"id": u"1", u"name": u"your", u"status": u"any"}>

Count

>>> client = Client("http://api.server.com/your/v1/")
>>> client.your.objects.count()
100

Filter

>>> client = Client("http://api.server.com/your/v1/")
>>> client.your.objects.filter(name="your")
<QuerySet <class 'Response'> (3/3)>

Save

>>> client = Client("http://api.server.com/your/v1/")
>>> your = client.your(name="name")
>>> your
<your: {u"name": u"name"}>
>>> your.save()  # save Your object.
>>> your
<your: {u"id": u"2", u"name": u"name"}>

Delete

>>> client = Client("http://api.server.com/your/v1/")
>>> message = client.message(subject="subject delete 1", body="body delete 1")
>>> message.save()
>>> message.id
<message: {u"id": u"1", u"subject": u"subject delete 1", u"body": u"body delete 1"}>
>>> message.delete()  # remove Message object.
>>> try:
>>>     message.id
>>> except AttributeError:
>>>     assert True  # throw AttributeError.

Setup

$ pip install tastypie-queryset-client

Documentation

tastypie-queryset-client.readthedocs.org

License

MIT License

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

tastypie-queryset-client-0.7.2.tar.gz (416.6 kB view details)

Uploaded Source

File details

Details for the file tastypie-queryset-client-0.7.2.tar.gz.

File metadata

File hashes

Hashes for tastypie-queryset-client-0.7.2.tar.gz
Algorithm Hash digest
SHA256 c00203c8daee130dafc802c7ed0e73c3e5933409d551b6c30514a1a6d76f2326
MD5 b582510decb8799cf4a97060fbc69b7f
BLAKE2b-256 d101f7ae228a96ad48668471aeede62327abba255117dac43d4f9ea0354959ce

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page