HTTP Transports are object based on restclient.transport.HTTPTransportBase that perform HTPP operations.
You can choose the one you want as transports in Resource or RestClient:
from restclient.transport import CurlTransport
transport = CurlTransport()
res = Resource(transport=transport)
Return the default http transport instance instance if no client has been set, it will create a default client.
Returns: | the default client |
---|
An object more like email.Message than httplib.HTTPResponse.
>>> from restclient import Resource
>>> res = Resource('http://e-engura.org')
>>> from restclient import Resource
>>> res = Resource('http://e-engura.org')
>>> page = res.get()
>>> res.status
200
>>> res.response['content-type']
'text/html'
>>> logo = res.get('/images/logo.gif')
>>> res.response['content-type']
'image/gif'
Interface for HTTP clients
constructor for HTTP transport interface
Parameters: |
|
---|
{
'proxy_user': 'XXXXXXX',
'proxy_password': 'XXXXXXX',
'proxy_host': 'proxy',
'proxy_port': 8080,
}
Perform HTTP call and manage , support GET, HEAD, POST, PUT and DELETE
Parameters: |
|
---|---|
Returns: | object representing HTTP Response |
An HTTP transportthat uses pycurl.
Pycurl is recommanded when you want fast access to http resources. We have added some basic management of authentification and proxies, but in case you want something specific you should use urllib2 or httplib2 http clients. Any patch is welcome though ;)
Here is an example to use authentification with curl httpclient :
httpclient = CurlTransport()
httpclient.add_credentials("test", "test")
See also
Curl transport constructor
Parameters: |
|
---|
{
'proxy_user': 'XXXXXXX',
'proxy_password': 'XXXXXXX',
'proxy_host': 'proxy',
'proxy_port': 8080,
}
An http client that uses httplib2 for performing HTTP requests. This implementation supports HTTP caching.
See also
Parameters: |
|
---|
{
'proxy_user': 'XXXXXXX',
'proxy_password': 'XXXXXXX',
'proxy_host': 'proxy',
'proxy_port': 8080,
}
Parameters: |
|
---|