Python Forum

Full Version: Proxy Issues with REQUESTS_HTML
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi

I am new to Python and am looking at scraping some data from a website. I sit behind a firewall and cannot make a connection to the outside world from my script. Internal websites work fine.

At the most very basic my code looks like this :

from requests_html import HTML, HTMLSession

session = HTMLSession(browser_args=["--proxy-server=192.168.56.210:8080"])
r = session.get('http://www.yyyyyy.govt.nz/')
#r = session.get('http://uno.xxxxxx.co.nz/') -- internal site that works

print(r.html)


I currently am getting an error : requests.exceptions.ConnectionError: ('Connection aborted.', ConnectionResetError(10054, 'An existing connection was forcibly closed by the remote host', None, 10054, None))

The proxy does not need a username/password

Can someone please confirm my syntax is correct and the best way to use a proxy with requests_html. I can then ask with confidence whether it is being blocked by the firewall.

Thanks

Andrew