# Error upgrading to Python dwolla 2.3.0

**URL:** https://discuss.dwolla.com/t/error-upgrading-to-python-dwolla-2-3-0/4537
**Category:** API Support
**Created:** [November 13, 2017, 2:03pm UTC](https://discuss.dwolla.com/t/error-upgrading-to-python-dwolla-2-3-0/4537 "2017-11-13T14:03:48Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![coldants](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/coldants/32/1936_2.png) [@coldants](https://discuss.dwolla.com/u/coldants)
#### Post date: [November 13, 2017, 2:03pm UTC](https://discuss.dwolla.com/t/error-upgrading-to-python-dwolla-2-3-0/4537/1 "2017-11-13T14:03:48Z")

</div>

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/](http://localhost:8888/pay/auth_redirect/)’}  
self: \<dwolla.rest.Rest object at 0x7f41bc9f76d0\>

---

<div class="post-metadata">

### Author: ![coldants](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/coldants/32/1936_2.png) [@coldants](https://discuss.dwolla.com/u/coldants)
#### Post date: [November 13, 2017, 4:13pm UTC](https://discuss.dwolla.com/t/error-upgrading-to-python-dwolla-2-3-0/4537/2 "2017-11-13T16:13:26Z")

</div>

After rebooting the dev server I’m getting an error I got previously - there’s no ‘Success’ key in the response dict:  
r: {u’\_links’: {u’account’: {u’href’: u’[https://api-sandbox.dwolla.com/accounts/[XXX]](https://api-sandbox.dwolla.com/accounts/%5BXXX%5D)}},  
u’access\_token’: u’MY ACCESS TOKEN’,  
u’account\_id’: u’MY ACCOUNT ID’,  
u’expires\_in’: Decimal(‘3602’),  
u’refresh\_expires\_in’: Decimal(‘5184002’),  
u’refresh\_token’: u’MY REFRESH TOKEN’,  
u’scope’: u’send|scheduled|funding|request|transactions’,  
u’token\_type’: u’bearer’}  
response : u’{"\_links":{“account”:{“href”:“[https://api-sandbox.dwolla.com/accounts/MY](https://api-sandbox.dwolla.com/accounts/MY) ACCOUNT ID”}},“access\_token”:“MY ACCESS TOKEN”,“expires\_in”:3602,“refresh\_token”:“MY REFRESH TOKEN”,“refresh\_expires\_in”:5184002,“token\_type”:“bearer”,“scope”:“send|scheduled|funding|request|transactions”,“account\_id”:“MY ACCOUNT ID”}'  
type   
‘dwolla’

---

<div class="post-metadata">

### Author: ![spencer](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/spencer/32/2143_2.png) [@spencer](https://discuss.dwolla.com/u/spencer)
#### Post date: [November 13, 2017, 8:55pm UTC](https://discuss.dwolla.com/t/error-upgrading-to-python-dwolla-2-3-0/4537/3 "2017-11-13T20:55:01Z")

</div>

@coldants, This may be a configuration issue. What do you have set as your host value? do you have `sandbox_host = 'https://sandbox.dwolla.com/'`

---

<div class="post-metadata">

### Author: ![coldants](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/coldants/32/1936_2.png) [@coldants](https://discuss.dwolla.com/u/coldants)
#### Post date: [November 13, 2017, 9:09pm UTC](https://discuss.dwolla.com/t/error-upgrading-to-python-dwolla-2-3-0/4537/4 "2017-11-13T21:09:57Z")

</div>

Yes, I’m not overriding that and I have sandbox set to True. The only other constants I’m overriding are client\_secret and client\_id

---

<div class="post-metadata">

### Author: ![coldants](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/coldants/32/1936_2.png) [@coldants](https://discuss.dwolla.com/u/coldants)
#### Post date: [November 16, 2017, 6:46pm UTC](https://discuss.dwolla.com/t/error-upgrading-to-python-dwolla-2-3-0/4537/5 "2017-11-16T18:46:20Z")

</div>

@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.

---

<div class="post-metadata">

### Author: ![coldants](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/coldants/32/1936_2.png) [@coldants](https://discuss.dwolla.com/u/coldants)
#### Post date: [November 17, 2017, 9:39pm UTC](https://discuss.dwolla.com/t/error-upgrading-to-python-dwolla-2-3-0/4537/6 "2017-11-17T21:39:59Z")

</div>

So here is a snippet from your examples section that will demonstrate an error in dwolla-python 2.3

> <https://gist.github.com/jrenaut/721759c1543f86a337b15ebbf0100c30>

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'
```

---

<div class="post-metadata">

### Author: ![spencer](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/spencer/32/2143_2.png) [@spencer](https://discuss.dwolla.com/u/spencer)
#### Post date: [November 17, 2017, 11:13pm UTC](https://discuss.dwolla.com/t/error-upgrading-to-python-dwolla-2-3-0/4537/7 "2017-11-17T23:13:55Z")

</div>

@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:

```python
access_set = oauth.get("Z/KHDIyWO/LboIGn3wGGs1+sRWg=", "http://requestb.in/122rdhc1")
print(access_set)

```

---

<div class="post-metadata">

### Author: ![coldants](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/coldants/32/1936_2.png) [@coldants](https://discuss.dwolla.com/u/coldants)
#### Post date: [November 17, 2017, 11:29pm UTC](https://discuss.dwolla.com/t/error-upgrading-to-python-dwolla-2-3-0/4537/8 "2017-11-17T23:29:18Z")

</div>

@spencer I think it used to but no longer:

```
Traceback (most recent call last):
  File "test.py", line 23, in <module>
    access_set = oauth.get("Z/KHDIyWO/LboIGn3wGGs1+sRWg=", "https://requestb.in/1nwwqrr1")
TypeError: get() takes exactly 1 argument (2 given)

```

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:

certifi==2017.11.5  
chardet==3.0.4  
dwolla==2.3.0  
funcsigs==1.0.2  
idna==2.6  
mock==2.0.0  
pbr==3.1.1  
requests==2.18.4  
six==1.11.0  
urllib3==1.22

---

<div class="post-metadata">

### Author: ![shreya](https://sea2.discourse-cdn.com/dwolla/user_avatar/discuss.dwolla.com/shreya/32/2154_2.png) [@shreya](https://discuss.dwolla.com/u/shreya)
#### Post date: [December 30, 2022, 10:04pm UTC](https://discuss.dwolla.com/t/error-upgrading-to-python-dwolla-2-3-0/4537/9 "2022-12-30T22:04:10Z")

</div>


