I’m upgrading from Python dwolla 2.2 to 2.3 and getting an error in oauth.get in the sandbox. I haven’t made any changes to my code yet, I was just testing things that were working fine with 2.2
Traceback:
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/exception.py" in inner
41. response = get_response(request)
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _legacy_get_response
249. response = self._get_response(request)
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
187. response = self.process_exception_by_middleware(e, request)
File "/usr/local/lib/python2.7/site-packages/django/core/handlers/base.py" in _get_response
185. response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/usr/local/lib/python2.7/site-packages/django/contrib/auth/decorators.py" in _wrapped_view
23. return view_func(request, *args, **kwargs)
File "/code/coldants/pay/views.py" in auth_redirect
130. info = oauth.get(code, redirect=redirect_url)
File "/usr/local/lib/python2.7/site-packages/dwolla/oauth.py" in get
69. return r._post_without_token('/token/', p, kwargs, custompostfix='/oauth/v2')
File "/usr/local/lib/python2.7/site-packages/dwolla/rest.py" in _post_without_token
82. print("dwolla-python: An error has occurred while making a POST request:\n" + '\n'.join(e.args))
Exception Type: TypeError at /pay/auth_redirect/
Exception Value: sequence item 0: expected string, ProtocolError found
Here’s the specific error:
custompostfix: '/oauth/v2’
e: ConnectionError(ProtocolError(‘Connection aborted.’, gaierror(-2, ‘Name or service not known’)),)
endpoint: '/token/‘
kwargs: {}
params: {‘client_id’: ‘MY CLIENT ID’,
‘client_secret’: ‘MY CLIENT SECRET’,
‘code’: u’MY CODE’,
‘grant_type’: ‘authorization_code’,
‘redirect_uri’: ‘http://localhost:8888/pay/auth_redirect/’}
self: <dwolla.rest.Rest object at 0x7f41bc9f76d0>
@spencer - anything further on this? I would very much like my website to continue working after 12/4 but I can’t put 2.3 into production when almost nothing works in the sandbox.
So here is a snippet from your examples section that will demonstrate an error in dwolla-python 2.3
I’m running that code in a virtualenv with just dwolla-python 2.3 installed, and it’s looking for a key that’s not in the response.
Traceback (most recent call last):
File "test.py", line 23, in <module>
access_set = oauth.get("Z/KHDIyWO/LboIGn3wGGs1+sRWg=")
File "/home/jrenaut/src/dwollatest2/lib/python2.7/site-packages/dwolla/oauth.py", line 69, in get
return r._post_without_token('/token/', p, kwargs, custompostfix='/oauth/v2')
File "/home/jrenaut/src/dwollatest2/lib/python2.7/site-packages/dwolla/rest.py", line 84, in _post_without_token
return self._parse(resp.text, kwargs.pop('dwollaparse', 'dwolla'))
File "/home/jrenaut/src/dwollatest2/lib/python2.7/site-packages/dwolla/rest.py", line 55, in _parse
if r['Success'] is not True:
KeyError: 'Success'
spencer
(Spencer Hunter - Lead Developer Advocate @ Dwolla)
7
@coldants, Thanks for sharing your gist. I wasn’t able to recreate the issue, however I believe oauth.get requires you to pass in a redirect_uri which should match the value that was used in the oauth.genauthurl() request. Something like:
Do I have some bad settings? The gist is the only code I wrote. It’s a new virtualenv, Python 2.7, all I did was pip install dwolla. Here’s the output from pip freeze: