

- #INSTALL URLLIB.REQUEST PACKAGE FOR PYTHON MAC INSTALL#
- #INSTALL URLLIB.REQUEST PACKAGE FOR PYTHON MAC CODE#
The handlers raise this exception (or derived exceptions) when they run into a problem. The following exceptions are raised as appropriate: exception urllib2.URLError If the Python installation has SSL support (i.e., if the ssl module can be imported), HTTPSHandler will also be added.īeginning in Python 2.3, a BaseHandler subclass may also change its handler_order attribute to modify its position in the handlers list. Instances of the following classes will be in front of the handlers, unless the handlers contain them, instances of them or subclasses of them: ProxyHandler (if proxy settings are detected), UnknownHandler, HTTPHandler, HTTPDefaultErrorHandler, HTTPRedirectHandler, FTPHandler, FileHandler, HTTPErrorProcessor. handlers can be either instances of BaseHandler, or subclasses of BaseHandler (in which case it must be possible to call the constructor without any parameters). Return an OpenerDirector instance, which chains the handlers in the order given.
#INSTALL URLLIB.REQUEST PACKAGE FOR PYTHON MAC CODE#
The code does not check for a real OpenerDirector, and any class with the appropriate interface will work. Installing an opener is only necessary if you want urlopen to use that opener otherwise, simply call OpenerDirector.open() instead of urlopen().

#INSTALL URLLIB.REQUEST PACKAGE FOR PYTHON MAC INSTALL#
Install an OpenerDirector instance as the default global opener. In addition, if proxy settings are detected (for example, when a *_proxy environment variable like http_proxy is set), ProxyHandler is default installed and makes sure the requests are handled through the proxy.Ĭhanged in version 2.7.9: cafile, capath, cadefault, and context were added. Note that None may be returned if no handler handles the request (though the default installed global OpenerDirector uses UnknownHandler to ensure this never happens).

urllib2 module sends HTTP/1.1 requests with Connection:close header included. data should be a buffer in the standard application/x-function takes a mapping or sequence of 2-tuples and returns a string in this format. Currently HTTP requests are the only ones that use data the HTTP request will be a POST instead of a GET when the data parameter is provided. Open the URL url, which can be either a string or a Request object.ĭata may be a string specifying additional data to send to the server, or None if no such data is needed. The urllib2 module defines the following functions: urllib2.urlopen(url]]]]) The Requests package is recommended for a higher-level HTTP client interface.
