Chans
Chans

Reputation: 23

How to add proxy support to mechanicalsoup?

import mechanicalsoup

proxies = {
    "http": "socks5://127.0.0.1:49260",
    "https": "socks5://127.0.0.1:49260"
}
url = 'https://whatismyip.com/'
browser = mechanicalsoup.StatefulBrowser()

browser.session.proxies = proxies   # This seem can't work

page = browser.open(url)  #, verify=False
print(page)
print(page.text)

I try to add proxy to my webbot, by using mechanicalsoup, but this can't work, and the official document didn't mention this, Where's a working demo about this? Thank you

Upvotes: 0

Views: 278

Answers (0)

Related Questions