相关文章推荐
会开车的小马驹  ·  jQuery Click Outside ...·  2 年前    · 
文武双全的四季豆  ·  opencv ...·  2 年前    · 
有腹肌的猕猴桃  ·  c# datetime.now wrong ...·  2 年前    · 
文雅的火锅  ·  java web文件上传 - 简书·  2 年前    · 

error 54, 'Connection reset by peer' #3189

@degroat

Description

I'm getting the dreaded Error 54, Connection reset by peer when trying to do a POST to a URL with a payment provider I'm using. Here is the basic code I'm running:

import requests, base64
url = "https://sandbox.api.mxmerchant.com/checkout/v3/auth/token/282059461"
headers = {
    'Authorization': 'Basic ' + base64.b64encode('myusername:mypassword')   ,
r = requests.post(url, headers=headers)
print r.text

If I run this exact code on an Ubuntu server it works fine (meaning it returns a json message stating that the username and password are incorrect).

If I run it on OSX 10.11.4, I get the connection reset error.

After reading a ton of issues on here and various postings on StackOverflow, everyone seems to think it's related to SNI. Unfortunately, none of the recommendations that I've come across have fixed the issue.

My Ubuntu server has Python 2.7.6, OpenSSL 1.0.1f and requests 2.8.1.

My OSX has Python 2.7.10, OpenSSL 1.0.2g and requests 2.10.0. I also have ndg-httpsclient and pyopenssl both installed per #1347

Any idea what it is that I'm missing?