Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Connection aborted" and "Cannot connect to proxy"

When the code bellow is running

import requests
monitor_r = requests.get(monitor_url, proxies=proxies, timeout=60*4)

I get these exceptions:

('Connection aborted.', BadStatusLine("''",))
# and 
('Cannot connect to proxy.', error(32, 'Broken pipe')))

What are these errors and how to fix them?

like image 760
no13bus Avatar asked Oct 20 '22 00:10

no13bus


1 Answers

This link suggests that it is caused at the httplib level.

  1. It may be caused by trying to connect to a https url using http try using https:// and see if it works...
  2. Double check your url doesn't contain any dodgy characters
  3. Check your proxy is accepting headers
like image 179
Alexander McFarlane Avatar answered Oct 27 '22 09:10

Alexander McFarlane