An open API service indexing awesome lists of open source software.

https://github.com/ikeikeikeike/tastypie-queryset-client

Client for Tastypie. Provide operation similar to the Django Model API .
https://github.com/ikeikeikeike/tastypie-queryset-client

Last synced: about 1 month ago
JSON representation

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

Awesome Lists containing this project

README

        

Tastypie Queryset Client
========================

Client for [Tastypie](https://github.com/toastdriven/django-tastypie). Provide operation similar to the Django Model API .

Usage
=====

Get
------
```python
>>> client = Client("http://api.server.com/your/v1/")
>>> client.your.objects.get(name="your")

```

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

Filter
------
```python
>>> client = Client("http://api.server.com/your/v1/")
>>> client.your.objects.filter(name="your")
(3/3)>
```

Save
----
```python
>>> client = Client("http://api.server.com/your/v1/")
>>> your = client.your(name="name")
>>> your

>>> your.save() # save Your object.
>>> your

```

Delete
------
```python
>>> client = Client("http://api.server.com/your/v1/")
>>> message = client.message(subject="subject delete 1", body="body delete 1")
>>> message.save()
>>> message.id

>>> message.delete() # remove Message object.
>>> try:
>>> message.id
>>> except AttributeError:
>>> assert True # throw AttributeError.
```

Requirements
=============

Tastypie: [Over the 0.9.12-alpha](https://github.com/toastdriven/django-tastypie/commit/daca57ad5f62afcf1ffacaaf77bc3715a1b9a04f).

Setup
=====
```bash
$ pip install tastypie-queryset-client
```

Documentation
==============

[tastypie-queryset-client.readthedocs.org](http://tastypie-queryset-client.readthedocs.org)

License
=======
MIT License