dwollav2
Advanced tools
| Metadata-Version: 2.1 | ||
| Name: dwollav2 | ||
| Version: 1.4.0 | ||
| Version: 1.5.0 | ||
| Summary: Official Dwolla V2 API client | ||
@@ -66,2 +66,6 @@ Home-page: https://docsv2.dwolla.com | ||
| ### Integrations Authorization | ||
| Check out our [Integrations Authorization Guide](https://developers.dwolla.com/integrations/authorization). | ||
| ## `Token` | ||
@@ -211,2 +215,3 @@ | ||
| - **1.5.0** Add integrations auth functionality | ||
| - **1.4.0** Allow kwargs to be passed to `get`, `post`, and `delete` methods. | ||
@@ -213,0 +218,0 @@ - **1.3.0** Change token URLs, update dependencies. |
+12
-8
@@ -22,2 +22,3 @@ try: | ||
| def _request_token(client, payload): | ||
@@ -32,10 +33,12 @@ res = session.post(client.token_url, data=payload) | ||
| def auth_for(_client): | ||
| class Auth: | ||
| def __init__(self, **kwargs): | ||
| self.redirect_uri = kwargs.get('redirect_uri') | ||
| self.scope = kwargs.get('scope') | ||
| self.state = kwargs.get('state') | ||
| self.verified_account = kwargs.get('verified_account') | ||
| self.dwolla_landing = kwargs.get('dwolla_landing') | ||
| def __init__(self, opts=None, **kwargs): | ||
| opts = kwargs if opts is None else opts | ||
| self.redirect_uri = opts.get('redirect_uri') | ||
| self.scope = opts.get('scope') | ||
| self.state = opts.get('state') | ||
| self.verified_account = opts.get('verified_account') | ||
| self.dwolla_landing = opts.get('dwolla_landing') | ||
@@ -46,3 +49,4 @@ @property | ||
| def callback(self, params): | ||
| def callback(self, params=None, **kwargs): | ||
| params = kwargs if params is None else params | ||
| if params.get('state') != self.state: | ||
@@ -70,3 +74,3 @@ raise ValueError('invalid state') | ||
| } | ||
| return dict((k, v) for k, v in iter(d.items()) if v is not None) | ||
| return dict((k, v) for k, v in iter(sorted(d.items())) if v is not None) | ||
@@ -73,0 +77,0 @@ @staticmethod |
+20
-11
@@ -7,12 +7,12 @@ from dwollav2.auth import auth_for | ||
| ENVIRONMENTS = { | ||
| 'production': { | ||
| 'auth_url': 'https://www.dwolla.com/oauth/v2/authenticate', | ||
| 'token_url': 'https://accounts.dwolla.com/token', | ||
| 'api_url': 'https://api.dwolla.com' | ||
| }, | ||
| 'sandbox': { | ||
| 'auth_url': 'https://sandbox.dwolla.com/oauth/v2/authenticate', | ||
| 'token_url': 'https://accounts-sandbox.dwolla.com/token', | ||
| 'api_url': 'https://api-sandbox.dwolla.com' | ||
| } | ||
| 'production': { | ||
| 'auth_url': 'https://accounts.dwolla.com/auth', | ||
| 'token_url': 'https://api.dwolla.com/token', | ||
| 'api_url': 'https://api.dwolla.com' | ||
| }, | ||
| 'sandbox': { | ||
| 'auth_url': 'https://accounts-sandbox.dwolla.com/auth', | ||
| 'token_url': 'https://api-sandbox.dwolla.com/token', | ||
| 'api_url': 'https://api-sandbox.dwolla.com' | ||
| } | ||
| } | ||
@@ -30,2 +30,11 @@ | ||
| def auth(self, opts=None, **kwargs): | ||
| return self.Auth(opts, **kwargs) | ||
| def refresh_token(self, opts=None, **kwargs): | ||
| return self.Auth.refresh(self.Token(opts, **kwargs)) | ||
| def token(self, opts=None, **kwargs): | ||
| return self.Token(opts, **kwargs) | ||
| @property | ||
@@ -43,3 +52,3 @@ def auth_url(self): | ||
| def Token(self, opts = None, **kwargs): | ||
| def Token(self, opts=None, **kwargs): | ||
| return Token(self, opts, **kwargs) |
+26
-0
| import requests | ||
| class Error(Exception): | ||
@@ -59,75 +60,100 @@ def __init__(self, res): | ||
| class AccessDeniedError(Error): | ||
| pass | ||
| class InvalidCredentialsError(Error): | ||
| pass | ||
| class NotFoundError(Error): | ||
| pass | ||
| class BadRequestError(Error): | ||
| pass | ||
| class InvalidGrantError(Error): | ||
| pass | ||
| class RequestTimeoutError(Error): | ||
| pass | ||
| class ExpiredAccessTokenError(Error): | ||
| pass | ||
| class InvalidRequestError(Error): | ||
| pass | ||
| class ServerError(Error): | ||
| pass | ||
| class ForbiddenError(Error): | ||
| pass | ||
| class InvalidResourceStateError(Error): | ||
| pass | ||
| class TemporarilyUnavailableError(Error): | ||
| pass | ||
| class InvalidAccessTokenError(Error): | ||
| pass | ||
| class InvalidScopeError(Error): | ||
| pass | ||
| class UnauthorizedClientError(Error): | ||
| pass | ||
| class InvalidAccountStatusError(Error): | ||
| pass | ||
| class UnsupportedGrantTypeError(Error): | ||
| pass | ||
| class InvalidApplicationStatusError(Error): | ||
| pass | ||
| class InvalidVersionError(Error): | ||
| pass | ||
| class UnsupportedResponseTypeError(Error): | ||
| pass | ||
| class InvalidClientError(Error): | ||
| pass | ||
| class MethodNotAllowedError(Error): | ||
| pass | ||
| class ValidationError(Error): | ||
| pass | ||
| class TooManyRequestsError(Error): | ||
| pass | ||
| class ConflictError(Error): | ||
| pass |
+17
-11
@@ -8,2 +8,3 @@ import requests | ||
| def _items_or_iteritems(o): | ||
@@ -15,2 +16,3 @@ try: | ||
| def _is_a_file(o): | ||
@@ -22,2 +24,3 @@ try: | ||
| def _contains_file(o): | ||
@@ -37,12 +40,13 @@ if isinstance(o, dict): | ||
| def token_for(_client): | ||
| class Token: | ||
| def __init__(self, opts = None, **kwargs): | ||
| def __init__(self, opts=None, **kwargs): | ||
| opts = kwargs if opts is None else opts | ||
| self.access_token = opts.get('access_token') | ||
| self.access_token = opts.get('access_token') | ||
| self.refresh_token = opts.get('refresh_token') | ||
| self.expires_in = opts.get('expires_in') | ||
| self.scope = opts.get('scope') | ||
| self.app_id = opts.get('app_id') | ||
| self.account_id = opts.get('account_id') | ||
| self.expires_in = opts.get('expires_in') | ||
| self.scope = opts.get('scope') | ||
| self.app_id = opts.get('app_id') | ||
| self.account_id = opts.get('account_id') | ||
@@ -56,7 +60,9 @@ self.session = requests.session() | ||
| def post(self, url, body = None, headers = {}, **kwargs): | ||
| def post(self, url, body=None, headers={}, **kwargs): | ||
| body = kwargs if body is None else body | ||
| if _contains_file(body): | ||
| files = [(k, v) for k, v in _items_or_iteritems(body) if _contains_file(v)] | ||
| data = [(k, v) for k, v in _items_or_iteritems(body) if not _contains_file(v)] | ||
| files = [(k, v) for k, v in _items_or_iteritems( | ||
| body) if _contains_file(v)] | ||
| data = [(k, v) for k, v in _items_or_iteritems( | ||
| body) if not _contains_file(v)] | ||
| return Response(self.session.post(self._full_url(url), headers=headers, files=files, data=data, **kwargs)) | ||
@@ -66,7 +72,7 @@ else: | ||
| def get(self, url, params = None, headers = {}, **kwargs): | ||
| def get(self, url, params=None, headers={}, **kwargs): | ||
| params = kwargs if params is None else params | ||
| return Response(self.session.get(self._full_url(url), headers=headers, params=params, **kwargs)) | ||
| def delete(self, url, params = None, headers = {}, **kwargs): | ||
| def delete(self, url, params=None, headers={}, **kwargs): | ||
| return Response(self.session.delete(self._full_url(url), headers=headers, params=params, **kwargs)) | ||
@@ -73,0 +79,0 @@ |
+6
-1
| Metadata-Version: 2.1 | ||
| Name: dwollav2 | ||
| Version: 1.4.0 | ||
| Version: 1.5.0 | ||
| Summary: Official Dwolla V2 API client | ||
@@ -66,2 +66,6 @@ Home-page: https://docsv2.dwolla.com | ||
| ### Integrations Authorization | ||
| Check out our [Integrations Authorization Guide](https://developers.dwolla.com/integrations/authorization). | ||
| ## `Token` | ||
@@ -211,2 +215,3 @@ | ||
| - **1.5.0** Add integrations auth functionality | ||
| - **1.4.0** Allow kwargs to be passed to `get`, `post`, and `delete` methods. | ||
@@ -213,0 +218,0 @@ - **1.3.0** Change token URLs, update dependencies. |
+5
-0
@@ -58,2 +58,6 @@ # DwollaV2 | ||
| ### Integrations Authorization | ||
| Check out our [Integrations Authorization Guide](https://developers.dwolla.com/integrations/authorization). | ||
| ## `Token` | ||
@@ -203,2 +207,3 @@ | ||
| - **1.5.0** Add integrations auth functionality | ||
| - **1.4.0** Allow kwargs to be passed to `get`, `post`, and `delete` methods. | ||
@@ -205,0 +210,0 @@ - **1.3.0** Change token URLs, update dependencies. |
+1
-1
@@ -12,3 +12,3 @@ import os | ||
| name='dwollav2', | ||
| version='1.4.0', | ||
| version='1.5.0', | ||
| packages=['dwollav2'], | ||
@@ -15,0 +15,0 @@ install_requires=[ |
Alert delta unavailable
Currently unable to show alert delta for PyPI packages.
42297
2.67%346
2.98%