This class wraps urllib2 and provides an easy way to make http requests while taking care of cookies, proxies, gzip compression and character encoding.
Example:
from t0mm0.common.net import Net
net = Net()
response = net.http_GET('http://xbmc.org')
print response.content
cookie_file (str): Full path to a file to be used to load and save cookies to.
proxy (str): Proxy setting (eg. 'http://user:pass@example.com:1234')
user_agent (str): String to use as the User Agent header. If not supplied the class will use a default user agent (chrome)
http_debug (bool): Set True to have HTTP header info written to the XBMC log for all requests.
Returns A dictionary containing all cookie information by domain.
Perform an HTTP GET request.
headers (dict): A dictionary describing any headers you would like to add to the request. (eg. {'X-Test': 'testing'})
compression (bool): If True (default), try to use gzip compression.
Perform an HTTP HEAD request.
Perform an HTTP POST request.
url (str): The URL to POST.
form_data (dict): A dictionary of form data to POST.
headers (dict): A dictionary describing any headers you would like to add to the request. (eg. {'X-Test': 'testing'})
compression (bool): If True (default), try to use gzip compression.
Saves cookies to a file.
Set the cookie file and try to load cookies from it if it exists.
This class represents a resoponse from an HTTP request.
The content is examined and every attempt is made to properly encode it to Unicode.
See also
Unicode encoded string containing the body of the reposne.