March 2019
Beginner
490 pages
12h 40m
English
We can use a proxy connection for the same task. If we need to specify a proxy in the code, we have to use an opener that contains the ProxyHandler handler. The default handler includes a ProxyHandler instance built by calling the initializer without parameters, which reads the list of proxies to use from the appropriate environment variable. However, we can also build a ProxyHandler, passing as a parameter a dictionary whose key is the HTTP protocol and the value is the proxy address or URL used for this protocol.
To install the opener once created, the install_opener function is used, which takes as a parameter the opener to be installed.
You can find the following code in the proxy_web_request.py file:
import ...
Read now
Unlock full access