New to Sandbox, simple question


(mikearul) #1

I’m just trying out the UAT environment with Python, using some sample code. I’ve installed dwollav2 successfully, but get the following error.

name ‘account_token’ is not defined.

The code is “transfer = account_token.post(‘transfers’, request_body)”

I think I need help understanding the commands to gain access to the API in the first place.

Thanks in advance.


(Stephen Ausman) #2

Hey Mike,

Before you are able to use an account_token you’ll need to either generate one here or obtain one by going through the OAuth flow. There are some examples at https://github.com/Dwolla/dwolla-v2-python#account-tokens that explain how to instantiate an account_token using either method. If you have any questions please let us know.


(Michael Arulgnanendran) #4

Hi Stephen,

I took another look at the instantiate code and am using that to define the account_token using the access token and refresh token generated by the sandbox Apps page. Python is running into an error saying “name ‘client’ is not defined” . I thought client.Token would have been a function defined by the dwollav2 package.

account_token = client.Token(access_token = ‘…’, refresh_token = ‘…’)


(Michael Arulgnanendran) #5

I was able to define client using some more code I found on github (below), but now Python is saying ‘os’ is not defined.

I entered the relevant app key and app secret from my UAT dashboard.

client = dwollav2.Client(
key = os.environ[‘DWOLLA_APP_KEY’],
secret = os.environ[‘DWOLLA_APP_SECRET’],
on_grant = lambda t: save(t)
)


(Michael Arulgnanendran) #6

resolved. thanks