got SSL: WRONG_VERSION_NUMBER

Posted almost 4 years ago by David Chen

Post a topic
Un Answered
D
David Chen

 

Got SSL: Wrong Version Number

url = "https://glia-1255417893.cos.ap-shanghai.myqcloud.com/Gnews.mp4"


proxy_host = "proxy.crawlera.com"

proxy_port = "8010"

proxy_auth = (

"...:" # Make sure to include ':' at the end

)

proxies = {

"https": "https://{}@{}:{}/".format(proxy_auth, proxy_host, proxy_port),

"http": "http://{}@{}:{}/".format(proxy_auth, proxy_host, proxy_port),

}


crt_file = Path(__file__).parent / "crawlera-ca.crt"

# tried: 

# verify = False/True

# verify=crt_file

r = requests.get(url, proxies=proxies, verify=False)


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,

)

)



urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='glia-1255417893.cos.ap-shanghai.myqcloud.com', port=443): Max retries exceeded with url: https://glia-1255417893.cos.ap-shanghai.myqcloud.com/Gnews.mp4 (Caused by SSLError(SSLError(1, '[SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:1125)')))

2 Votes


2 Comments

Sorted by
S

Sir Loras posted over 1 year ago

@Matt Cone this is not solution. With http scheme you just basically sending requests to http proxies which not required certificate.

0 Votes

M

Matt Cone posted over 3 years ago

 I found the solution to this. Follow the instructions in this GitHub comment: https://github.com/urllib3/urllib3/issues/2075#issuecomment-730765490


This line: "https": "https://{}@{}:{}/".format(proxy_auth, proxy_host, proxy_port),


Should actually be this: "https": "http://{}@{}:{}/".format(proxy_auth, proxy_host, proxy_port),

1 Votes

Login to post a comment