requests-html icon indicating copy to clipboard operation
requests-html copied to clipboard

Proxies parameter in BaseSession __init__

Open l3str4nge opened this issue 4 years ago • 4 comments

Due to #345 I noticed that user can't use proxy. In requests proxy is used as following requests.get(URL, proxies={}) so we need to have proxies attribute in BaseSession.

l3str4nge avatar Jun 02 '20 06:06 l3str4nge

So now requests-html support the use of proxy also when using the render method?

MrIdjit avatar Jul 30 '20 13:07 MrIdjit

How to specify?

bitnom avatar Sep 25 '20 01:09 bitnom

Yes with this fix, render() also uses the proxy settings. Plus, proxies can be configured at the HTMLSession() level so you don't have to set them per request.

Note that you'll still need to configure browser_args with --proxy-server option to get puppeteer to use the proxy settings. This PR fixes the request session side of things which we also need.

Could we get this PR merged please?

ediril avatar Dec 30 '20 11:12 ediril

Possible to get this merged?

andrewshrout avatar Aug 27 '22 22:08 andrewshrout

Doesn't work

proxy_url = f"http://{proxy_config.username}:{proxy_config.password}@{proxy_config.host}:{proxy_config.port}"
proxies = {'http': proxy_url, 'https': proxy_url}

js_session = HTMLSession(browser_args=[f"--proxy-server={proxy_config.host}:{proxy_config.port}"])
response = js_session.get(url="https://vk.com/audio?block=chart", proxies=proxies)

response.html.render()

In this example program stucking on response.html.render() line

v9lu avatar Dec 17 '23 13:12 v9lu