You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

dwollav2

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dwollav2 - pypi Package Compare versions

Comparing version
2.2.1
to
2.3.0
+102
-55
dwollav2.egg-info/PKG-INFO
Metadata-Version: 2.1
Name: dwollav2
Version: 2.2.1
Version: 2.3.0
Summary: Official Dwolla V2 API client

@@ -9,3 +9,2 @@ Home-page: https://docsv2.dwolla.com

License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta

@@ -28,26 +27,43 @@ Classifier: Intended Audience :: Developers

License-File: LICENSE.txt
Requires-Dist: requests>=2.9.1
# DwollaV2
# Dwolla SDK for Python
Dwolla V2 Python client.
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.
[API Documentation](https://docsv2.dwolla.com)
## Table of Contents
## Installation
- [Getting Started](#getting-started)
- [Installation](#installation)
- [Initialization](#initialization)
- [Tokens](#tokens)
- [Making Requests](#making-requests)
- [Low-level Requests](#low-level-requests)
- [Setting Headers](#setting-headers)
- [Responses](#responses)
- [Success](#success)
- [Error](#error)
- [Example App](#example-app)
- [Changelog](#changelog)
- [Community](#community)
- [Additional Resources](#additional-resources)
`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/).
## Getting Started
### Installation
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/).
```shell
$ pip install dwollav2
```
pip install dwollav2
```
## `dwollav2.Client`
### Initialization
### Basic usage
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:
Create a client using your application's consumer key and secret found on the applications page
([Sandbox][apsandbox], [Production][approd]).
- Production: https://dashboard.dwolla.com/applications
- Sandbox: https://dashboard-sandbox.dwolla.com/applications
[apsandbox]: https://dashboard-sandbox.dwolla.com/applications
[approd]: https://dashboard.dwolla.com/applications
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.

@@ -63,3 +79,3 @@ ```python

### Configure an `on_grant` callback (optional)
##### Configure an `on_grant` callback (optional)

@@ -79,16 +95,8 @@ An `on_grant` callback is useful for storing new tokens when they are granted. The `on_grant`

### Integrations Authorization
#### Tokens
Check out our [Integrations Authorization Guide](https://developers.dwolla.com/integrations/authorization).
##### Generating New Access Tokens
## `Token`
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:
Tokens can be used to make requests to the Dwolla V2 API.
### Application tokens
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:
[client_credentials]: https://tools.ietf.org/html/rfc6749#section-4.4
```python

@@ -98,8 +106,7 @@ application_token = client.Auth.client()

_Application tokens do not include a `refresh_token`. When an application token expires, generate
a new one using `client.Auth.client()`._
_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()`._
### Initializing pre-existing tokens:
##### Initializing Pre-Existing Tokens:
`Token`s can be initialized with the following attributes:
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:

@@ -111,6 +118,12 @@ ```python

## Requests
## Making Requests
`Token`s can make requests using the `#get`, `#post`, and `#delete` methods.
Once you've created a `Token`, currently, you can make low-level HTTP requests.
### Low-level Requests
To make low-level HTTP requests, you can use the `get()`, `post()`, and `delete()` methods. These methods will return a `Response` object.
#### `GET`
```python

@@ -120,2 +133,10 @@ # GET api.dwolla.com/resource?foo=bar

# GET requests can also use objects as parameters
# GET api.dwolla.com/resource?foo=bar
token.get('resource', {'foo' = 'bar', 'baz' = 'foo'})
```
#### `POST`
```python
# POST api.dwolla.com/resource {"foo":"bar"}

@@ -126,6 +147,7 @@ token.post('resource', foo = 'bar')

token.post('resource', foo = ('mclovin.jpg', open('mclovin.jpg', 'rb'), 'image/jpeg'))
```
# PUT api.dwolla.com/resource {"foo":"bar"}
token.put('resource', foo = 'bar')
#### `DELETE`
```python
# DELETE api.dwolla.com/resource

@@ -146,6 +168,10 @@ token.delete('resource')

## Responses
#### Responses
Requests return a `Response`.
The following snippets demonstrate successful and errored responses from the Dwolla API.
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.
##### Success
```python

@@ -164,3 +190,3 @@ res = token.get('/')

## Errors
##### Error

@@ -186,5 +212,5 @@ If the server returns an error, a `dwollav2.Error` (or one of its subclasses) will be raised.

### `dwollav2.Error` subclasses:
###### `dwollav2.Error` subclasses:
_See https://docsv2.dwolla.com/#errors for more info._
_See https://developers.dwolla.com/api-reference#errors for more info._

@@ -218,19 +244,16 @@ - `dwollav2.AccessDeniedError`

## Development
### Example App
After checking out the repo, run `pip install -r requirements.txt` to install dependencies.
Then, run `python setup.py test` to run the tests.
Take a look at the
[Sample Application](https://github.com/Dwolla/dwolla-v2-python/tree/main/sample_app) for examples
on how to use this SDK to call the Dwolla API. Before you can begin using the app, however,
you will need to specify a `DWOLLA_APP_KEY` and `DWOLLA_APP_SECRET` environment variable.
To install this gem onto your local machine, run `pip install -e .`.
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/Dwolla/dwolla-v2-python.
## License
The package is available as open source under the terms of the [MIT License](https://github.com/Dwolla/dwolla-v2-python).
## Changelog
- **2.3.0**
- Remove hidden dependency on `simplejson`. Replace conditional `simplejson` import with explicit `DecimalEncoder` using standard library `json` module for consistent cross-environment behavior. Fixes [#55](https://github.com/Dwolla/dwolla-v2-python/issues/55). ([#56](https://github.com/Dwolla/dwolla-v2-python/pull/56) - Thanks [@robotadam](https://github.com/robotadam)!)
- Update test suite from `unittest2` to standard library `unittest` for modern Python compatibility. ([#54](https://github.com/Dwolla/dwolla-v2-python/pull/54) - Thanks [@robotadam](https://github.com/robotadam)!)
- Remove unused `future` dependency for cleaner dependency management. Fixes [#52](https://github.com/Dwolla/dwolla-v2-python/issues/52). ([#53](https://github.com/Dwolla/dwolla-v2-python/pull/53) Thanks [@robotadam](https://github.com/robotadam)!)
- Add `UpdateCredentialsError` class for handling credential update scenarios in Open Banking integrations. Developers can now catch specific `UpdateCredentialsError` exceptions instead of generic `Error` when exchange sessions need re-authentication. Fixes [#50](https://github.com/Dwolla/dwolla-v2-python/issues/50)
- **2.2.1**

@@ -263,3 +286,3 @@ - Add extra check in URL's to ensure they are clean. [#36](https://github.com/Dwolla/dwolla-v2-python/pull/36).

- **1.1.8** Support `verified_account` and `dwolla_landing` auth flags
- **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!)
- **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)!
- **1.1.5** Fix file upload bug when using with Python 2 ([#6](https://github.com/Dwolla/dwolla-v2-python/issues/6))

@@ -270,4 +293,28 @@ - **1.1.2** Add `TooManyRequestsError` and `ConflictError`

[`idempotency-key`]: https://docs.dwolla.com/#idempotency-key
## Community
- 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).
- 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!
- After checking out the repo, run `pip install -r requirements.txt` to install dependencies. Then, run `python setup.py` test to run the tests.
- To install this gem onto your local machine, `run pip install -e .`.
## Docker
If you prefer to use Docker to run dwolla-v2-python locally, a Dockerfile is included at the root directory.
Follow these instructions from [Docker's website](https://docs.docker.com/build/hellobuild/) to create a Docker image from the Dockerfile, and run it.
## Additional Resources
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!
- [Dwolla](https://www.dwolla.com/)
- [Dwolla Developers](https://developers.dwolla.com/)
- [SDKs and Tools](https://developers.dwolla.com/sdks-tools)
- [Dwolla SDK for C#](https://github.com/Dwolla/dwolla-v2-csharp)
- [Dwolla SDK for Kotlin](https://github.com/Dwolla/dwolla-v2-kotlin)
- [Dwolla SDK for Node](https://github.com/Dwolla/dwolla-v2-node)
- [Dwolla SDK for PHP](https://github.com/Dwolla/dwolla-swagger-php)
- [Dwolla SDK for Ruby](https://github.com/Dwolla/dwolla-v2-ruby)
- [Developer Support Forum](https://discuss.dwolla.com/)
[`idempotency-key`]: https://docs.dwolla.com/#idempotency-key
requests>=2.9.1
future>=0.15.2

@@ -51,3 +51,4 @@ import requests

'TooManyRequests': TooManyRequestsError,
'Conflict': ConflictError
'Conflict': ConflictError,
'UpdateCredentials': UpdateCredentialsError,
}.get(c, Error)(res)

@@ -160,1 +161,6 @@

pass
class UpdateCredentialsError(Error):
pass
import requests
from io import IOBase
import re
import json
import decimal
try:
import simplejson as json
except ImportError:
import json
from dwollav2.response import Response

@@ -14,2 +11,9 @@ from dwollav2.version import version

class DecimalEncoder(json.JSONEncoder):
def default(self, o):
if isinstance(o, decimal.Decimal):
return str(o)
return super().default(o)
def _items_or_iteritems(o):

@@ -78,3 +82,3 @@ try:

{'content-type': 'application/json'}, headers),
data=json.dumps(body, sort_keys=True, indent=2),
data=json.dumps(body, sort_keys=True, indent=2, cls=DecimalEncoder),
**requests))

@@ -81,0 +85,0 @@

@@ -1,1 +0,1 @@

version = '2.2.1'
version = '2.3.0'
+102
-55
Metadata-Version: 2.1
Name: dwollav2
Version: 2.2.1
Version: 2.3.0
Summary: Official Dwolla V2 API client

@@ -9,3 +9,2 @@ Home-page: https://docsv2.dwolla.com

License: MIT
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta

@@ -28,26 +27,43 @@ Classifier: Intended Audience :: Developers

License-File: LICENSE.txt
Requires-Dist: requests>=2.9.1
# DwollaV2
# Dwolla SDK for Python
Dwolla V2 Python client.
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.
[API Documentation](https://docsv2.dwolla.com)
## Table of Contents
## Installation
- [Getting Started](#getting-started)
- [Installation](#installation)
- [Initialization](#initialization)
- [Tokens](#tokens)
- [Making Requests](#making-requests)
- [Low-level Requests](#low-level-requests)
- [Setting Headers](#setting-headers)
- [Responses](#responses)
- [Success](#success)
- [Error](#error)
- [Example App](#example-app)
- [Changelog](#changelog)
- [Community](#community)
- [Additional Resources](#additional-resources)
`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/).
## Getting Started
### Installation
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/).
```shell
$ pip install dwollav2
```
pip install dwollav2
```
## `dwollav2.Client`
### Initialization
### Basic usage
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:
Create a client using your application's consumer key and secret found on the applications page
([Sandbox][apsandbox], [Production][approd]).
- Production: https://dashboard.dwolla.com/applications
- Sandbox: https://dashboard-sandbox.dwolla.com/applications
[apsandbox]: https://dashboard-sandbox.dwolla.com/applications
[approd]: https://dashboard.dwolla.com/applications
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.

@@ -63,3 +79,3 @@ ```python

### Configure an `on_grant` callback (optional)
##### Configure an `on_grant` callback (optional)

@@ -79,16 +95,8 @@ An `on_grant` callback is useful for storing new tokens when they are granted. The `on_grant`

### Integrations Authorization
#### Tokens
Check out our [Integrations Authorization Guide](https://developers.dwolla.com/integrations/authorization).
##### Generating New Access Tokens
## `Token`
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:
Tokens can be used to make requests to the Dwolla V2 API.
### Application tokens
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:
[client_credentials]: https://tools.ietf.org/html/rfc6749#section-4.4
```python

@@ -98,8 +106,7 @@ application_token = client.Auth.client()

_Application tokens do not include a `refresh_token`. When an application token expires, generate
a new one using `client.Auth.client()`._
_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()`._
### Initializing pre-existing tokens:
##### Initializing Pre-Existing Tokens:
`Token`s can be initialized with the following attributes:
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:

@@ -111,6 +118,12 @@ ```python

## Requests
## Making Requests
`Token`s can make requests using the `#get`, `#post`, and `#delete` methods.
Once you've created a `Token`, currently, you can make low-level HTTP requests.
### Low-level Requests
To make low-level HTTP requests, you can use the `get()`, `post()`, and `delete()` methods. These methods will return a `Response` object.
#### `GET`
```python

@@ -120,2 +133,10 @@ # GET api.dwolla.com/resource?foo=bar

# GET requests can also use objects as parameters
# GET api.dwolla.com/resource?foo=bar
token.get('resource', {'foo' = 'bar', 'baz' = 'foo'})
```
#### `POST`
```python
# POST api.dwolla.com/resource {"foo":"bar"}

@@ -126,6 +147,7 @@ token.post('resource', foo = 'bar')

token.post('resource', foo = ('mclovin.jpg', open('mclovin.jpg', 'rb'), 'image/jpeg'))
```
# PUT api.dwolla.com/resource {"foo":"bar"}
token.put('resource', foo = 'bar')
#### `DELETE`
```python
# DELETE api.dwolla.com/resource

@@ -146,6 +168,10 @@ token.delete('resource')

## Responses
#### Responses
Requests return a `Response`.
The following snippets demonstrate successful and errored responses from the Dwolla API.
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.
##### Success
```python

@@ -164,3 +190,3 @@ res = token.get('/')

## Errors
##### Error

@@ -186,5 +212,5 @@ If the server returns an error, a `dwollav2.Error` (or one of its subclasses) will be raised.

### `dwollav2.Error` subclasses:
###### `dwollav2.Error` subclasses:
_See https://docsv2.dwolla.com/#errors for more info._
_See https://developers.dwolla.com/api-reference#errors for more info._

@@ -218,19 +244,16 @@ - `dwollav2.AccessDeniedError`

## Development
### Example App
After checking out the repo, run `pip install -r requirements.txt` to install dependencies.
Then, run `python setup.py test` to run the tests.
Take a look at the
[Sample Application](https://github.com/Dwolla/dwolla-v2-python/tree/main/sample_app) for examples
on how to use this SDK to call the Dwolla API. Before you can begin using the app, however,
you will need to specify a `DWOLLA_APP_KEY` and `DWOLLA_APP_SECRET` environment variable.
To install this gem onto your local machine, run `pip install -e .`.
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/Dwolla/dwolla-v2-python.
## License
The package is available as open source under the terms of the [MIT License](https://github.com/Dwolla/dwolla-v2-python).
## Changelog
- **2.3.0**
- Remove hidden dependency on `simplejson`. Replace conditional `simplejson` import with explicit `DecimalEncoder` using standard library `json` module for consistent cross-environment behavior. Fixes [#55](https://github.com/Dwolla/dwolla-v2-python/issues/55). ([#56](https://github.com/Dwolla/dwolla-v2-python/pull/56) - Thanks [@robotadam](https://github.com/robotadam)!)
- Update test suite from `unittest2` to standard library `unittest` for modern Python compatibility. ([#54](https://github.com/Dwolla/dwolla-v2-python/pull/54) - Thanks [@robotadam](https://github.com/robotadam)!)
- Remove unused `future` dependency for cleaner dependency management. Fixes [#52](https://github.com/Dwolla/dwolla-v2-python/issues/52). ([#53](https://github.com/Dwolla/dwolla-v2-python/pull/53) Thanks [@robotadam](https://github.com/robotadam)!)
- Add `UpdateCredentialsError` class for handling credential update scenarios in Open Banking integrations. Developers can now catch specific `UpdateCredentialsError` exceptions instead of generic `Error` when exchange sessions need re-authentication. Fixes [#50](https://github.com/Dwolla/dwolla-v2-python/issues/50)
- **2.2.1**

@@ -263,3 +286,3 @@ - Add extra check in URL's to ensure they are clean. [#36](https://github.com/Dwolla/dwolla-v2-python/pull/36).

- **1.1.8** Support `verified_account` and `dwolla_landing` auth flags
- **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!)
- **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)!
- **1.1.5** Fix file upload bug when using with Python 2 ([#6](https://github.com/Dwolla/dwolla-v2-python/issues/6))

@@ -270,4 +293,28 @@ - **1.1.2** Add `TooManyRequestsError` and `ConflictError`

[`idempotency-key`]: https://docs.dwolla.com/#idempotency-key
## Community
- 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).
- 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!
- After checking out the repo, run `pip install -r requirements.txt` to install dependencies. Then, run `python setup.py` test to run the tests.
- To install this gem onto your local machine, `run pip install -e .`.
## Docker
If you prefer to use Docker to run dwolla-v2-python locally, a Dockerfile is included at the root directory.
Follow these instructions from [Docker's website](https://docs.docker.com/build/hellobuild/) to create a Docker image from the Dockerfile, and run it.
## Additional Resources
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!
- [Dwolla](https://www.dwolla.com/)
- [Dwolla Developers](https://developers.dwolla.com/)
- [SDKs and Tools](https://developers.dwolla.com/sdks-tools)
- [Dwolla SDK for C#](https://github.com/Dwolla/dwolla-v2-csharp)
- [Dwolla SDK for Kotlin](https://github.com/Dwolla/dwolla-v2-kotlin)
- [Dwolla SDK for Node](https://github.com/Dwolla/dwolla-v2-node)
- [Dwolla SDK for PHP](https://github.com/Dwolla/dwolla-swagger-php)
- [Dwolla SDK for Ruby](https://github.com/Dwolla/dwolla-v2-ruby)
- [Developer Support Forum](https://discuss.dwolla.com/)
[`idempotency-key`]: https://docs.dwolla.com/#idempotency-key
+101
-52

@@ -1,24 +0,40 @@

# DwollaV2
# Dwolla SDK for Python
Dwolla V2 Python client.
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.
[API Documentation](https://docsv2.dwolla.com)
## Table of Contents
## Installation
- [Getting Started](#getting-started)
- [Installation](#installation)
- [Initialization](#initialization)
- [Tokens](#tokens)
- [Making Requests](#making-requests)
- [Low-level Requests](#low-level-requests)
- [Setting Headers](#setting-headers)
- [Responses](#responses)
- [Success](#success)
- [Error](#error)
- [Example App](#example-app)
- [Changelog](#changelog)
- [Community](#community)
- [Additional Resources](#additional-resources)
`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/).
## Getting Started
### Installation
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/).
```shell
$ pip install dwollav2
```
pip install dwollav2
```
## `dwollav2.Client`
### Initialization
### Basic usage
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:
Create a client using your application's consumer key and secret found on the applications page
([Sandbox][apsandbox], [Production][approd]).
- Production: https://dashboard.dwolla.com/applications
- Sandbox: https://dashboard-sandbox.dwolla.com/applications
[apsandbox]: https://dashboard-sandbox.dwolla.com/applications
[approd]: https://dashboard.dwolla.com/applications
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.

@@ -34,3 +50,3 @@ ```python

### Configure an `on_grant` callback (optional)
##### Configure an `on_grant` callback (optional)

@@ -50,16 +66,8 @@ An `on_grant` callback is useful for storing new tokens when they are granted. The `on_grant`

### Integrations Authorization
#### Tokens
Check out our [Integrations Authorization Guide](https://developers.dwolla.com/integrations/authorization).
##### Generating New Access Tokens
## `Token`
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:
Tokens can be used to make requests to the Dwolla V2 API.
### Application tokens
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:
[client_credentials]: https://tools.ietf.org/html/rfc6749#section-4.4
```python

@@ -69,8 +77,7 @@ application_token = client.Auth.client()

_Application tokens do not include a `refresh_token`. When an application token expires, generate
a new one using `client.Auth.client()`._
_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()`._
### Initializing pre-existing tokens:
##### Initializing Pre-Existing Tokens:
`Token`s can be initialized with the following attributes:
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:

@@ -82,6 +89,12 @@ ```python

## Requests
## Making Requests
`Token`s can make requests using the `#get`, `#post`, and `#delete` methods.
Once you've created a `Token`, currently, you can make low-level HTTP requests.
### Low-level Requests
To make low-level HTTP requests, you can use the `get()`, `post()`, and `delete()` methods. These methods will return a `Response` object.
#### `GET`
```python

@@ -91,2 +104,10 @@ # GET api.dwolla.com/resource?foo=bar

# GET requests can also use objects as parameters
# GET api.dwolla.com/resource?foo=bar
token.get('resource', {'foo' = 'bar', 'baz' = 'foo'})
```
#### `POST`
```python
# POST api.dwolla.com/resource {"foo":"bar"}

@@ -97,6 +118,7 @@ token.post('resource', foo = 'bar')

token.post('resource', foo = ('mclovin.jpg', open('mclovin.jpg', 'rb'), 'image/jpeg'))
```
# PUT api.dwolla.com/resource {"foo":"bar"}
token.put('resource', foo = 'bar')
#### `DELETE`
```python
# DELETE api.dwolla.com/resource

@@ -117,6 +139,10 @@ token.delete('resource')

## Responses
#### Responses
Requests return a `Response`.
The following snippets demonstrate successful and errored responses from the Dwolla API.
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.
##### Success
```python

@@ -135,3 +161,3 @@ res = token.get('/')

## Errors
##### Error

@@ -157,5 +183,5 @@ If the server returns an error, a `dwollav2.Error` (or one of its subclasses) will be raised.

### `dwollav2.Error` subclasses:
###### `dwollav2.Error` subclasses:
_See https://docsv2.dwolla.com/#errors for more info._
_See https://developers.dwolla.com/api-reference#errors for more info._

@@ -189,19 +215,16 @@ - `dwollav2.AccessDeniedError`

## Development
### Example App
After checking out the repo, run `pip install -r requirements.txt` to install dependencies.
Then, run `python setup.py test` to run the tests.
Take a look at the
[Sample Application](https://github.com/Dwolla/dwolla-v2-python/tree/main/sample_app) for examples
on how to use this SDK to call the Dwolla API. Before you can begin using the app, however,
you will need to specify a `DWOLLA_APP_KEY` and `DWOLLA_APP_SECRET` environment variable.
To install this gem onto your local machine, run `pip install -e .`.
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/Dwolla/dwolla-v2-python.
## License
The package is available as open source under the terms of the [MIT License](https://github.com/Dwolla/dwolla-v2-python).
## Changelog
- **2.3.0**
- Remove hidden dependency on `simplejson`. Replace conditional `simplejson` import with explicit `DecimalEncoder` using standard library `json` module for consistent cross-environment behavior. Fixes [#55](https://github.com/Dwolla/dwolla-v2-python/issues/55). ([#56](https://github.com/Dwolla/dwolla-v2-python/pull/56) - Thanks [@robotadam](https://github.com/robotadam)!)
- Update test suite from `unittest2` to standard library `unittest` for modern Python compatibility. ([#54](https://github.com/Dwolla/dwolla-v2-python/pull/54) - Thanks [@robotadam](https://github.com/robotadam)!)
- Remove unused `future` dependency for cleaner dependency management. Fixes [#52](https://github.com/Dwolla/dwolla-v2-python/issues/52). ([#53](https://github.com/Dwolla/dwolla-v2-python/pull/53) Thanks [@robotadam](https://github.com/robotadam)!)
- Add `UpdateCredentialsError` class for handling credential update scenarios in Open Banking integrations. Developers can now catch specific `UpdateCredentialsError` exceptions instead of generic `Error` when exchange sessions need re-authentication. Fixes [#50](https://github.com/Dwolla/dwolla-v2-python/issues/50)
- **2.2.1**

@@ -234,3 +257,3 @@ - Add extra check in URL's to ensure they are clean. [#36](https://github.com/Dwolla/dwolla-v2-python/pull/36).

- **1.1.8** Support `verified_account` and `dwolla_landing` auth flags
- **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!)
- **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)!
- **1.1.5** Fix file upload bug when using with Python 2 ([#6](https://github.com/Dwolla/dwolla-v2-python/issues/6))

@@ -241,2 +264,28 @@ - **1.1.2** Add `TooManyRequestsError` and `ConflictError`

## Community
- 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).
- 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!
- After checking out the repo, run `pip install -r requirements.txt` to install dependencies. Then, run `python setup.py` test to run the tests.
- To install this gem onto your local machine, `run pip install -e .`.
## Docker
If you prefer to use Docker to run dwolla-v2-python locally, a Dockerfile is included at the root directory.
Follow these instructions from [Docker's website](https://docs.docker.com/build/hellobuild/) to create a Docker image from the Dockerfile, and run it.
## Additional Resources
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!
- [Dwolla](https://www.dwolla.com/)
- [Dwolla Developers](https://developers.dwolla.com/)
- [SDKs and Tools](https://developers.dwolla.com/sdks-tools)
- [Dwolla SDK for C#](https://github.com/Dwolla/dwolla-v2-csharp)
- [Dwolla SDK for Kotlin](https://github.com/Dwolla/dwolla-v2-kotlin)
- [Dwolla SDK for Node](https://github.com/Dwolla/dwolla-v2-node)
- [Dwolla SDK for PHP](https://github.com/Dwolla/dwolla-swagger-php)
- [Dwolla SDK for Ruby](https://github.com/Dwolla/dwolla-v2-ruby)
- [Developer Support Forum](https://discuss.dwolla.com/)
[`idempotency-key`]: https://docs.dwolla.com/#idempotency-key

@@ -12,7 +12,6 @@ import os

name='dwollav2',
version='2.2.1',
version='2.3.0',
packages=['dwollav2'],
install_requires=[
'requests>=2.9.1',
'future>=0.15.2'
],

@@ -19,0 +18,0 @@ test_suite='dwollav2.test.all',