Regarding requests in Python 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)
Regarding requests in Python 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)
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)