ikeikeikeike/tastypie-queryset-client — pull request #41 by danielnaab (2013-02-12 21:13:33+00:00)
Title: JSON serialization and configurable client sessions

This pull request includes two commits. First, makes the client kwarg to Client() refer to an instance instead of class object. This allows for the use of a custom requests auth hook:

from oauth_hook import OAuthHook
import requests
import slumber
from queryset_client import Client

if __name__ == '__main__':
oauth_hook = OAuthHook(TOKEN_KEY, TOKEN_SECRET, KEY, SECRET, header_auth=True)

session = requests.session(hooks={'pre_request': oauth_hook})
api = slumber.API(
base_url=ENDPOINT,
session=session)
client = Client(ENDPOINT, client=api)
print list(client.coupon.objects.all())

Secondly, included for your consideration, I encountered issues parsing JSON with the slumber serializer, so the second commit uses the requests library's built in JSON support instead.