0

Set PhantomJS HTTPS proxy have a question. Use the following code. Please help me.

service_args = [
    '--proxy='+ip[1],
    '--proxy-type=http',
]
driver = webdriver.PhantomJS(executable_path= os.getcwd()+'/driver/phantomjs.exe',service_args=service_args)

Python request use HTTPS proxy is OK, but my set PhantomJS HTTPS proxy Can't access. Python request use HTTPS proxy, use the following code :

proxies = { "https":ip[1] }
stringContent = requests.get("http:xx.com",headers = headers,proxies=proxies)
ɢʀᴜɴᴛ
  • 32,025
  • 15
  • 116
  • 110
c.shang
  • 1
  • 1

1 Answers1

0

https proxy is not supported by PhantomJS. So best is to use http proxy or a socks proxy

--proxy-type= Specifies the proxy type, 'http' (default), 'none' (disable completely), or 'socks5'

If for some reason, you still want things to work then you would need something like SQUID or some other proxy server which can listen on http proxy and forward it to https proxy.

Below links can be of help in that case

https://www.rootusers.com/configure-squid-proxy-to-forward-to-a-parent-proxy/

Squid: forward to another proxy (with authentication details for the parent proxy)

Tarun Lalwani
  • 142,312
  • 9
  • 204
  • 265