Cannot connect to proxy.', ConnectionResetError(10054, 'xxxxxx。', None, 10054, None

Posted about 6 years ago by ArjunPython

Post a topic
Un Answered
A
ArjunPython

import requests
headers = {
'User-Agent':'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.75 Safari/537.36',
}
url = "https://twitter.com"
proxy_host = "proxy.crawlera.com"
proxy_port = "8010"
proxy_auth = "<APIKEY>:"

proxies = {"http": "http://{}@{}:{}/".format(proxy_auth, proxy_host, proxy_port),
"https": "https://{}@{}:{}/".format(proxy_auth, proxy_host, proxy_port),
}
r = requests.get(url,proxies=proxies,headers=headers)
print(r)

print("""
Requesting [{}]
through proxy [{}]

Request Headers:
{}

Response Time: {}
Response Code: {}
Response Headers:
{}

""".format(url, proxy_host, r.request.headers, r.elapsed.total_seconds(),
r.status_code, r.headers, r.text))

0 Votes


18 Comments

Sorted by
A

ArjunPython posted about 6 years ago

Yes, I haven't subscribed to Crawlera yet. I am currently testing my friend's account to see if I can crawl twitter, but why have I been prompted for proxy errors?

0 Votes

nestor

nestor posted about 6 years ago Admin

I don't see a Crawlera subscription on your account.

In any case, seems like you might need to open port 8010 on your machine.

0 Votes

A

ArjunPython posted about 6 years ago

python 3.6.3

requests 2.20

0 Votes

Login to post a comment