I am trying to make an api request to Paypal in Sandbox mode but getting a urlopen SSL error.
api_url = 'https://api-3t.sandbox.paypal.com/nvp'
data =
{'CANCELURL': 'http://localhost:8000/paypal/canceled/',
'L_PAYMENTREQUEST_0_AMT0': '2749.00',
'L_PAYMENTREQUEST_0_DESC0': 'Like Christmas in a cup',
'L_PAYMENTREQUEST_0_NAME0': 'Apple ',
'L_PAYMENTREQUEST_0_QTY0': '1',
'METHOD': 'SetExpressCheckout',
'PAYMENTREQUEST_0_AMT': '2749.00',
'PAYMENTREQUEST_0_CURRENCYCODE': 'USD',
'PAYMENTREQUEST_0_DESC': 'Your payment to Foobar Inc.',
'PAYMENTREQUEST_0_ITEMAMT': '2749.00',
'PAYMENTREQUEST_0_PAYMENTACTION': 'Sale',
'PWD': '****',
'RETURNURL': 'http://localhost:8000/paypal/confirm/',
'SIGNATURE': '****',
'USER': '****',
'VERSION': '91.0'}
response = urllib2.urlopen(api_url, data=urlencode(data))
Response Im getting is
Traceback (most recent call last): File "", line 1, in File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen return opener.open(url, data, timeout) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open response = self._open(req, data) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open '_open', req) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain result = func(*args) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1240, in https_open context=self._context) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1197, in do_open raise URLError(err) URLError:
Is it because I am sending the request from non-https client(localhost)? I tried this few months back it was working fine. Are there any settings I have to change ? Is this a recent change in API ?