0
Regarding Python requests using mechanicalsoup, how do I open the site using a proxy.
import mechanicalsoup
br = mechanicalsoup.StatefulBrowser()
site = 'www.exemplo.com.br'
open = br.open(site)
resp = open.text
print(resp)
0
Regarding Python requests using mechanicalsoup, how do I open the site using a proxy.
import mechanicalsoup
br = mechanicalsoup.StatefulBrowser()
site = 'www.exemplo.com.br'
open = br.open(site)
resp = open.text
print(resp)
0
Through session.proxies
:
import mechanicalsoup
br = mechanicalsoup.StatefulBrowser()
site = 'www.exemplo.com.br'
proxies = {
'https': 'my.https.proxy:8080',
'http': 'my.http.proxy:8080'
}
br.session.proxies = proxies
open = br.open(site)
resp = open.text
print(resp)
Browser other questions tagged python
You are not signed in. Login or sign up in order to post.
(Caused by Proxyerror('Cannot connect to proxy. ', Newconnectionerror('<urllib3.connection.Verifiedhttpsconnection Object at 0x0316AC70>: Failed to Establish a new Connection: [Errno 11004] getaddrinfo failed'
– Jhoony Fr0id
@Jhoonyfr0id "cannot connect to proxy" -> seems to be something wrong with your proxy.
– Pedro von Hertwig Batista