Welcome to RESTKit’s documentation!

Restkit is an HTTP resource kit for Python. It allows you to easily access to HTTP resource and build objects around it. It’s the base of couchdbkit a Python CouchDB framework.

You can simply use restkit.request() function to do any HTTP requests.

Usage example, get a friendpaste paste:

>>> from restkit import request
>>> r = request('http://friendpaste.com/1ZSEoJeOarc3ULexzWOk5Y_633433316631/raw')
>>> r.body_string()
'welcome to friendpaste'
>>> r.headers
{'status': '200 OK', 'transfer-encoding': 'chunked', 'set-cookie':
'FRIENDPASTE_SID=b581975029d689119d3e89416e4c2f6480a65d96; expires=Sun,
14-Mar-2010 03:29:31 GMT; Max-Age=1209600; Path=/', 'server': 'nginx/0.7.62',
'connection': 'keep-alive', 'date': 'Sun, 28 Feb 2010 03:29:31 GMT',
'content-type': 'text/plain'}

of from a resource:

>>> from restkit import Resource
>>> res = Resource('http://friendpaste.com')
>>> r = res.get('/1ZSEoJeOarc3ULexzWOk5Y_633433316631/raw')
>>> r.body_string()
'welcome to friendpaste'

but you can do more like building object mapping HTTP resources, ....

Note

restkit source code is hosted on Github

Features

  • Full compatible HTTP client for HTTP 1.0 and 1.1
  • Threadsafe
  • Use pure socket calls and its own HTTP parser (It’s not based on httplib or urllib2)
  • Map HTTP resources to Python objects
  • Read and Send on the fly
  • Reuses connections
  • Eventlet and Gevent support
  • Support Chunked transfer encoding in both ways.
  • Support Basic Authentification and OAuth.
  • Multipart forms and url-encoded forms
  • Streaming support
  • Proxy handling
  • HTTP Filters, you can hook requests in responses with your own callback
  • Compatible with Python 2.x (>= 2.6)