You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+81-51Lines changed: 81 additions & 51 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,26 +1,42 @@
1
-
# DwollaV2
1
+
# Dwolla SDK for Python
2
2
3
-
Dwolla V2 Python client.
3
+
This repository contains the source code for Dwolla's Python-based SDK, which allows developers to interact with Dwolla's server-side API via a Python API. Any action that can be performed via an HTTP request can be made using this SDK when executed within a server-side environment.
4
4
5
-
[API Documentation](https://docsv2.dwolla.com)
5
+
## Table of Contents
6
6
7
-
## Installation
7
+
-[Getting Started](#getting-started)
8
+
-[Installation](#installation)
9
+
-[Initialization](#initialization)
10
+
-[Tokens](#tokens)
11
+
-[Making Requests](#making-requests)
12
+
-[Low-level Requests](#low-level-requests)
13
+
-[Setting Headers](#setting-headers)
14
+
-[Responses](#responses)
15
+
-[Success](#success)
16
+
-[Error](#error)
17
+
-[Changelog](#changelog)
18
+
-[Community](#community)
19
+
-[Additional Resources](#additional-resources)
8
20
9
-
`dwollav2` is available on [PyPi](https://pypi.python.org/pypi/dwollav2), and therefore can be installed automagically via [pip](https://pip.pypa.io/en/stable/installing/).
10
21
11
-
```
12
-
pip install dwollav2
22
+
## Getting Started
23
+
24
+
### Installation
25
+
26
+
To begin using this SDK, you will first need to download it to your machine. We use [PyPi](https://pypi.python.org/pypi/dwollav2) to distribute this package from where you can automagically download it via [pip](https://pip.pypa.io/en/stable/installing/).
27
+
28
+
```shell
29
+
$ pip install dwollav2
13
30
```
14
31
15
-
##`dwollav2.Client`
32
+
### Initialization
16
33
17
-
### Basic usage
34
+
Before any API requests can be made, you must first determine which environment you will be using, as well as fetch the application key and secret. To fetch your application key and secret, please visit one of the following links:
18
35
19
-
Create a client using your application's consumer key and secret found on the applications page
Finally, you can create an instance of `Client` with `key` and `secret` replaced with the application key and secret that you fetched from one of the aforementioned links, respectively.
24
40
25
41
```python
26
42
client = dwollav2.Client(
@@ -31,7 +47,7 @@ client = dwollav2.Client(
31
47
)
32
48
```
33
49
34
-
### Configure an `on_grant` callback (optional)
50
+
#####Configure an `on_grant` callback (optional)
35
51
36
52
An `on_grant` callback is useful for storing new tokens when they are granted. The `on_grant`
37
53
callback is called with the `Token` that was just granted by the server.
@@ -46,53 +62,57 @@ client = dwollav2.Client(
46
62
47
63
It is highly recommended that you encrypt any token data you store.
48
64
49
-
##`Token`
65
+
#### Tokens
50
66
51
-
Tokens can be used to make requests to the Dwolla V2 API.
67
+
##### Generating New Access Tokens
52
68
53
-
### Application tokens
69
+
Application access tokens are used to authenticate against the API on behalf of an application. Application tokens can be used to access resources in the API that either belong to the application itself (`webhooks`, `events`, `webhook-subscriptions`) or the Dwolla Account that owns the application (`accounts`, `customers`, `funding-sources`, etc.). Application tokens are obtained by using the [`client_credentials`](https://tools.ietf.org/html/rfc6749#section-4.4) OAuth grant type:
54
70
55
-
Application access tokens are used to authenticate against the API on behalf of a consumer application. Application tokens can be used to access resources in the API that either belong to the application itself (`webhooks`, `events`, `webhook-subscriptions`) or the partner Account that owns the consumer application (`accounts`, `customers`, `funding-sources`, etc.). Application tokens are obtained by using the [`client_credentials`][client_credentials] OAuth grant type:
_Application tokens do not include a `refresh_token`. When an application token expires, generate
64
-
a new one using `client.Auth.client()`._
76
+
_Application access tokens are short-lived: 1 hour. They do not include a `refresh_token`. When it expires, generate a new one using `client.Auth.client()`._
65
77
66
-
### Initializing pre-existing tokens:
78
+
#####Initializing Pre-Existing Tokens:
67
79
68
-
`Token`s can be initialized with the following attributes:
80
+
The [Dwolla Sandbox Dashboard](https://dashboard-sandbox.dwolla.com/applications-legacy) allows you to generate tokens for your application. A `Token` can be initialized with the following attributes:
69
81
70
82
```python
71
83
client.Token(access_token='...',
72
84
expires_in=123)
73
85
```
74
86
75
-
## Requests
87
+
## Making Requests
88
+
89
+
Once you've created a `Token`, currently, you can make low-level HTTP requests.
90
+
91
+
### Low-level Requests
76
92
77
-
`Token`s can make requests using the `#get`, `#post`, and `#delete` methods.
93
+
To make low-level HTTP requests, you can use the `get()`, `post()`, and `delete()` methods. These methods will return a `Response` object.
The following snippets demonstrate successful and errored responses from the Dwolla API.
134
+
135
+
An errored response is returned when Dwolla's servers respond with a status code that is greater than or equal to 400, whereas a successful response is when Dwolla's servers respond with a 200-level status code.
If the server returns an error, a `dwollav2.Error` (or one of its subclasses) will be raised.
131
155
`dwollav2.Error`s are similar to `Response`s.
@@ -145,10 +169,9 @@ except dwollav2.NotFoundError as e:
145
169
except dwollav2.Error:
146
170
# ...
147
171
```
172
+
###### `dwollav2.Error` subclasses:
148
173
149
-
### `dwollav2.Error` subclasses:
150
-
151
-
_See https://docsv2.dwolla.com/#errors for more info._
174
+
_See https://developers.dwolla.com/api-reference#errors for more info._
152
175
153
176
-`dwollav2.AccessDeniedError`
154
177
-`dwollav2.InvalidCredentialsError`
@@ -177,21 +200,6 @@ _See https://docsv2.dwolla.com/#errors for more info._
177
200
-`dwollav2.TooManyRequestsError`
178
201
-`dwollav2.ConflictError`
179
202
180
-
## Development
181
-
182
-
After checking out the repo, run `pip install -r requirements.txt` to install dependencies.
183
-
Then, run `python setup.py test` to run the tests.
184
-
185
-
To install this gem onto your local machine, run `pip install -e .`.
186
-
187
-
## Contributing
188
-
189
-
Bug reports and pull requests are welcome on GitHub at https://github.com/Dwolla/dwolla-v2-python.
190
-
191
-
## License
192
-
193
-
The package is available as open source under the terms of the [MIT License](https://github.com/Dwolla/dwolla-v2-python).
194
-
195
203
## Changelog
196
204
197
205
-**2.2.1**
@@ -221,10 +229,32 @@ The package is available as open source under the terms of the [MIT License](htt
221
229
-**1.2.1** Update sandbox URLs from uat => sandbox.
222
230
-**1.2.0** Refer to Client id as key.
223
231
-**1.1.8** Support `verified_account` and `dwolla_landing` auth flags
224
-
-**1.1.7** Use session over connections for [performance improvement](http://docs.python-requests.org/en/master/user/advanced/#session-objects) ([#8](https://github.com/Dwolla/dwolla-v2-python/pull/8) - Thanks @bfeeser!)
232
+
-**1.1.7** Use session over connections for [performance improvement](http://docs.python-requests.org/en/master/user/advanced/#session-objects) ([#8](https://github.com/Dwolla/dwolla-v2-python/pull/8) - Thanks [@bfeeser](https://github.com/bfeeser)!
225
233
-**1.1.5** Fix file upload bug when using with Python 2 ([#6](https://github.com/Dwolla/dwolla-v2-python/issues/6))
226
234
-**1.1.2** Add `TooManyRequestsError` and `ConflictError`
227
235
-**1.1.1** Add MANIFEST.in
228
236
-**1.1.0** Support per-request headers
229
237
238
+
## Community
239
+
* If you have any feedback, please reach out to us on [our forums](https://discuss.dwolla.com/) or by [creating a GitHub issue](https://github.com/Dwolla/dwolla-v2-python/issues/new).
240
+
* If you would like to contribute to this library, [bug reports](https://github.com/Dwolla/dwolla-v2-python/issues) and [pull requests](https://github.com/Dwolla/dwolla-v2-python/pulls) are always appreciated!
241
+
* After checking out the repo, run `pip install -r requirements.txt` to install dependencies. Then, run `python setup.py` test to run the tests.
242
+
* To install this gem onto your local machine, `run pip install -e .`.
243
+
244
+
245
+
## Additional Resources
246
+
247
+
To learn more about Dwolla and how to integrate our product with your application, please consider visiting the following resources and becoming a member of our community!
0 commit comments