Viewing file: atom.http.html (23.25 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
Python: module atom.http
HttpClients in this module use httplib to make HTTP requests.
This module make HTTP requests based on httplib, but there are environments
in which an httplib based approach will not work (if running in Google App
Engine for example). In those cases, higher level classes (like AtomService
and GDataService) can swap out the HttpClient to transparently use a
different mechanism for making HTTP requests.
HttpClient: Contains a request method which performs an HTTP call to the
server.
ProxiedHttpClient: Contains a request method which connects to a proxy using
settings stored in operating system environment variables then
performs an HTTP call to the endpoint server.
Classes |
| |
- atom.http_interface.Error(exceptions.Exception)
-
- ProxyError
- atom.http_interface.GenericHttpClient(__builtin__.object)
-
- HttpClient
-
- ProxiedHttpClient
- exceptions.Exception(exceptions.BaseException)
-
- TestConfigurationError
class HttpClient(atom.http_interface.GenericHttpClient) |
| |
- Method resolution order:
- HttpClient
- atom.http_interface.GenericHttpClient
- __builtin__.object
Methods defined here:
- __init__(self, headers=None)
- request(self, operation, url, data=None, headers=None)
- Performs an HTTP call to the server, supports GET, POST, PUT, and
DELETE.
Usage example, perform and HTTP GET on http://www.google.com/:
import atom.http
client = atom.http.HttpClient()
http_response = client.request('GET', 'http://www.google.com/')
Args:
operation: str The HTTP operation to be performed. This is usually one
of 'GET', 'POST', 'PUT', or 'DELETE'
data: filestream, list of parts, or other object which can be converted
to a string. Should be set to None when performing a GET or DELETE.
If data is a file-like object which can be read, this method will
read a chunk of 100K bytes at a time and send them.
If the data is a list of parts to be sent, each part will be
evaluated and sent.
url: The full URL to which the request should be sent. Can be a string
or atom.url.Url.
headers: dict of strings. HTTP headers which should be sent
in the request.
Data and other attributes defined here:
- v2_http_client = None
Methods inherited from atom.http_interface.GenericHttpClient:
- delete(self, url, headers=None)
- get(self, url, headers=None)
- post(self, url, data, headers=None)
- put(self, url, data, headers=None)
Data descriptors inherited from atom.http_interface.GenericHttpClient:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from atom.http_interface.GenericHttpClient:
- debug = False
|
class ProxiedHttpClient(HttpClient) |
|
Performs an HTTP request through a proxy.
The proxy settings are obtained from enviroment variables. The URL of the
proxy server is assumed to be stored in the environment variables
'https_proxy' and 'http_proxy' respectively. If the proxy server requires
a Basic Auth authorization header, the username and password are expected to
be in the 'proxy-username' or 'proxy_username' variable and the
'proxy-password' or 'proxy_password' variable.
After connecting to the proxy server, the request is completed as in
HttpClient.request. |
|
- Method resolution order:
- ProxiedHttpClient
- HttpClient
- atom.http_interface.GenericHttpClient
- __builtin__.object
Methods inherited from HttpClient:
- __init__(self, headers=None)
- request(self, operation, url, data=None, headers=None)
- Performs an HTTP call to the server, supports GET, POST, PUT, and
DELETE.
Usage example, perform and HTTP GET on http://www.google.com/:
import atom.http
client = atom.http.HttpClient()
http_response = client.request('GET', 'http://www.google.com/')
Args:
operation: str The HTTP operation to be performed. This is usually one
of 'GET', 'POST', 'PUT', or 'DELETE'
data: filestream, list of parts, or other object which can be converted
to a string. Should be set to None when performing a GET or DELETE.
If data is a file-like object which can be read, this method will
read a chunk of 100K bytes at a time and send them.
If the data is a list of parts to be sent, each part will be
evaluated and sent.
url: The full URL to which the request should be sent. Can be a string
or atom.url.Url.
headers: dict of strings. HTTP headers which should be sent
in the request.
Data and other attributes inherited from HttpClient:
- v2_http_client = None
Methods inherited from atom.http_interface.GenericHttpClient:
- delete(self, url, headers=None)
- get(self, url, headers=None)
- post(self, url, data, headers=None)
- put(self, url, data, headers=None)
Data descriptors inherited from atom.http_interface.GenericHttpClient:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from atom.http_interface.GenericHttpClient:
- debug = False
|
|
Data |
| |
DEFAULT_CONTENT_TYPE = 'application/atom+xml'
__author__ = 'api.jscudder (Jeff Scudder)'
ssl_imported = True |
Author |
| |
api.jscudder (Jeff Scudder) |
|