官方dwolla v2 api客户端
dwollav2的Python项目详细描述
dwollav2
==
…图::https://travis ci.org/dwolla/dwolla-v2-python.svg
:alt:build status
dwolla v2 python客户端。
`api文档<;https://docsv2.dwolla.com>;`` dwollav2`可在
`pypi<;http上找到因此,可以通过
`pip<;https://pip.pypa.io/en/稳定/installing/>;`` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ~
使用在"应用程序"页上找到的应用程序的使用者密钥和机密创建客户机
(`sandbox<;https://dashboard sandbox.dwolla.com/application s>;``uuuu,
`production<;https://dashboard.dwolla.com/applications>;`uu)。
。代码::python
client=dwollav2.client(id=os.environ['dwolla_app_key',secret=os.environ['dwolla_app_secret'])
代码::python
client=dwollav2.client(
key=os.environ['dwolla-app-key',
secret=os.environ['dwolla-app-secret',
environment='sandbox'
)
`` environment``默认为`` production```.
配置`` on-grant``回调(optional)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``on-grant``回调对于存储新的令牌(当它们被
授予时)非常有用。使用服务器刚刚授予的"token"调用"on-grant"回调。代码::python
client=dwollav2.client(
key=os.environ['dwolla-app-key'],
secret=os.environ['dwolla-app-secret'],
on-grant=lambda t:save(t)
/>——
令牌可用于向dwolla v2 api发出请求。
应用程序令牌可用于
访问api中的资源,这些资源要么属于应用程序本身
(``webhooks``,``events`,``webhook subscriptions`),要么属于拥有消费者应用程序的合作伙伴
帐户(``accounts`,``customers`,
``funding sources`,等等)。应用程序令牌通过使用
``客户机凭据`<;https://tools.ietf.org/html/rfc6749第4.4节>;`
OAuth授权类型:
代码::python
application廑token=client.auth.client()
*应用程序令牌不包括"刷新"令牌。当
应用程序令牌过期时,使用
``client.auth.client()``.*
代码::python
client.token(access_token='…',
expires_in=123)
requests
--
``token`\s可以使用``` get``、`` post``和
`` delete``方法发出请求。
代码::python
获取api.dwolla.com/resource?foo=bar
token.get('resource',foo='bar')
rb'),'image/jpeg'))
氮磷将
头的"dict"作为第三个参数。
例如:
…代码::python
token.post('customers',{'firstname':'john','lastname':'doe','email':'jd@doe.com'},
{'idempotency key':'a52fcf63-0730-41c3-96e8-7147b5d1fb01'})
responses
--
代码::python
res=token.get('/')
=>;200
res.headers
=>;{'server'=>;'cloudflare-nginx','date'=>;'mon,2016年3月28日15:30:23 GMT','content type'=>;'application/vnd.dwolla.v1.hal+json;charset=utf-8','content length'=>;'150,'连接'=>;'close,'设置cookie'=>;'''uu cfduid=d9dcd0f5856c16c16c16c16c66c16c16c16c16c16c66c16c14b66c16b66c16b16b11459179023;expires=tue,3月28日,3月17日15:30:23 GMT;path=/;domain=.dwolla.com;httponly,'x-request-id'=>;'69a4e64e612-5dae-5dae-4c52-a6aaa6-2f921e92e134a34a88a,''cf ray'=>;'cf ray'=>>
决议body['''u links']['events']['ref']
=>;'https://api sandbox.dwolla.com/events'
errors
----
>如果服务器返回错误,将引发一个``dwollav2.error``(或其一个
子类)。`` dwollav2.error``\s与
``response`\s类似。
…代码::python
尝试:
令牌。get('/not found')
除了dwollav2。notfounderror:
e.status
/vnd.dwolla.v1.hal+json;profile=\"http://nocarrier.co.uk/profiles/vnd.error/\";charset=utf-8,"content length"=>;"69","connection"=>;"close","set cookie"=>;"\uuu cfduid=da1478bfdf3e56275cd8a64186ccce1459179332;expires=tue,17年3月28日15:35:32 gmt;path=/;domain=.dwolla.com;httponly","a"ccess control allow origin"=>;""*","x-request-id"=>;"667FCA74-B53D-43DB-BDDD-50426A11881","cf-ray"=>;"28AC270ABCA64207 MSP"}
=>;"notfound"
除了dwollav2。错误:
"…
``dwollav2.error``子类:
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~请求时间eoutrorror`
-``dwollav2.expiredaccesstokenerror`
-``dwollav2.invalidridequesterror``
-``dwollav2.servererror`
-``dwollav2.forbiddenerror`
-``dwollav2.invalidresourcestateerror`
-``dwollav2.temporarilyunavailableerror`
-``dwollav2.invalidaccesstokenerror``
-``dwollav2.invalidScopeerror`
-``dwollav2.unauthorizedClienterror`
-``dwollav2.invalidAccountStatuserror`
-``dwollav2.invalidScopesRor`
-``dwollav2.unsupportdGrantTypeerror`
-``dwollav2.invalidApplicationStatusRor`
-``dwollav2.invalidversionerror``
-``dwollav2.unsupportedresponsetypeerror`
-``dwollav2.invalidclienterror``
-``dwollav2.methodnotallowederror``
-``dwollav2.validationerror`
-``dwollav2.toomanyrequesserror``
-``dwollav2.conflicterror`
开发签出repo,运行"pip install-r requirements.txt"以
安装依赖项。然后,运行"python setup.py test"来运行
测试。
Cense
----
根据"mit
许可证"lt;https://github.com/dwolla/dwolla-v2-python>;` ` ` ` ` ` ` `.
----
-**1.2.4**创建新会话f或者每个令牌。
-**1.2.3**在检查某个文件是否是
文件时检查iobase。
-**1.2.2**从提供给令牌的url中删除域。\*方法。
-**1.2.1**从uat=>;沙盒中更新沙盒url。
-**1.2.0**将客户端id作为密钥。
-**1.1.8**支持``验证帐户和dwolla登录名auth
flags
-**1.1.7**通过连接使用会话来提高性能<;http://docs.python requests.org/en/master/user/advanced/session objects>;`
(` 8<;https://github.com/dwolla/dwolla-v2-python/pull/8>;。`_-谢谢
@bfeeser!)
-**1.1.5**修复与python 2一起使用时的文件上载错误
(` 6<;https://github.com/dwolla/dwolla-v2-python/issues/6>;` `)
-**1.1.2**添加``toomanyrequestserror``和``conflicterror`
-**1.1.1**添加manifest.in
-**1.1.0**支持每个请求头
==
…图::https://travis ci.org/dwolla/dwolla-v2-python.svg
:alt:build status
`api文档<;https://docsv2.dwolla.com>;`` dwollav2`可在
`pypi<;http上找到因此,可以通过
`pip<;https://pip.pypa.io/en/稳定/installing/>;`` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ~
使用在"应用程序"页上找到的应用程序的使用者密钥和机密创建客户机
(`sandbox<;https://dashboard sandbox.dwolla.com/application s>;``uuuu,
`production<;https://dashboard.dwolla.com/applications>;`uu)。
。代码::python
client=dwollav2.client(id=os.environ['dwolla_app_key',secret=os.environ['dwolla_app_secret'])
代码::python
client=dwollav2.client(
key=os.environ['dwolla-app-key',
secret=os.environ['dwolla-app-secret',
environment='sandbox'
)
`` environment``默认为`` production```.
配置`` on-grant``回调(optional)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
``on-grant``回调对于存储新的令牌(当它们被
授予时)非常有用。使用服务器刚刚授予的"token"调用"on-grant"回调。代码::python
client=dwollav2.client(
key=os.environ['dwolla-app-key'],
secret=os.environ['dwolla-app-secret'],
on-grant=lambda t:save(t)
/>——
令牌可用于向dwolla v2 api发出请求。
应用程序令牌可用于
访问api中的资源,这些资源要么属于应用程序本身
(``webhooks``,``events`,``webhook subscriptions`),要么属于拥有消费者应用程序的合作伙伴
帐户(``accounts`,``customers`,
``funding sources`,等等)。应用程序令牌通过使用
``客户机凭据`<;https://tools.ietf.org/html/rfc6749第4.4节>;`
OAuth授权类型:
代码::python
application廑token=client.auth.client()
*应用程序令牌不包括"刷新"令牌。当
应用程序令牌过期时,使用
``client.auth.client()``.*
代码::python
client.token(access_token='…',
expires_in=123)
requests
--
``token`\s可以使用``` get``、`` post``和
`` delete``方法发出请求。
代码::python
获取api.dwolla.com/resource?foo=bar
token.get('resource',foo='bar')
rb'),'image/jpeg'))
氮磷将
头的"dict"作为第三个参数。
例如:
…代码::python
token.post('customers',{'firstname':'john','lastname':'doe','email':'jd@doe.com'},
{'idempotency key':'a52fcf63-0730-41c3-96e8-7147b5d1fb01'})
responses
--
代码::python
res=token.get('/')
res.headers
=>;{'server'=>;'cloudflare-nginx','date'=>;'mon,2016年3月28日15:30:23 GMT','content type'=>;'application/vnd.dwolla.v1.hal+json;charset=utf-8','content length'=>;'150,'连接'=>;'close,'设置cookie'=>;'''uu cfduid=d9dcd0f5856c16c16c16c16c66c16c16c16c16c16c66c16c14b66c16b66c16b16b11459179023;expires=tue,3月28日,3月17日15:30:23 GMT;path=/;domain=.dwolla.com;httponly,'x-request-id'=>;'69a4e64e612-5dae-5dae-4c52-a6aaa6-2f921e92e134a34a88a,''cf ray'=>;'cf ray'=>>
决议body['''u links']['events']['ref']
=>;'https://api sandbox.dwolla.com/events'
errors
----
>如果服务器返回错误,将引发一个``dwollav2.error``(或其一个
子类)。`` dwollav2.error``\s与
``response`\s类似。
…代码::python
尝试:
令牌。get('/not found')
除了dwollav2。notfounderror:
e.status
/vnd.dwolla.v1.hal+json;profile=\"http://nocarrier.co.uk/profiles/vnd.error/\";charset=utf-8,"content length"=>;"69","connection"=>;"close","set cookie"=>;"\uuu cfduid=da1478bfdf3e56275cd8a64186ccce1459179332;expires=tue,17年3月28日15:35:32 gmt;path=/;domain=.dwolla.com;httponly","a"ccess control allow origin"=>;""*","x-request-id"=>;"667FCA74-B53D-43DB-BDDD-50426A11881","cf-ray"=>;"28AC270ABCA64207 MSP"}
除了dwollav2。错误:
"…
``dwollav2.error``子类:
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~请求时间eoutrorror`
-``dwollav2.expiredaccesstokenerror`
-``dwollav2.invalidridequesterror``
-``dwollav2.servererror`
-``dwollav2.forbiddenerror`
-``dwollav2.invalidresourcestateerror`
-``dwollav2.temporarilyunavailableerror`
-``dwollav2.invalidaccesstokenerror``
-``dwollav2.invalidScopeerror`
-``dwollav2.unauthorizedClienterror`
-``dwollav2.invalidAccountStatuserror`
-``dwollav2.invalidScopesRor`
-``dwollav2.unsupportdGrantTypeerror`
-``dwollav2.invalidApplicationStatusRor`
-``dwollav2.invalidversionerror``
-``dwollav2.unsupportedresponsetypeerror`
-``dwollav2.invalidclienterror``
-``dwollav2.methodnotallowederror``
-``dwollav2.validationerror`
-``dwollav2.toomanyrequesserror``
-``dwollav2.conflicterror`
开发签出repo,运行"pip install-r requirements.txt"以
安装依赖项。然后,运行"python setup.py test"来运行
测试。
Cense
----
根据"mit
许可证"lt;https://github.com/dwolla/dwolla-v2-python>;` ` ` ` ` ` ` `.
-**1.2.4**创建新会话f或者每个令牌。
-**1.2.3**在检查某个文件是否是
文件时检查iobase。
-**1.2.2**从提供给令牌的url中删除域。\*方法。
-**1.2.1**从uat=>;沙盒中更新沙盒url。
-**1.2.0**将客户端id作为密钥。
-**1.1.8**支持``验证帐户和dwolla登录名auth
flags
-**1.1.7**通过连接使用会话来提高性能<;http://docs.python requests.org/en/master/user/advanced/session objects>;`
(` 8<;https://github.com/dwolla/dwolla-v2-python/pull/8>;。`_-谢谢
@bfeeser!)
-**1.1.5**修复与python 2一起使用时的文件上载错误
(` 6<;https://github.com/dwolla/dwolla-v2-python/issues/6>;` `)
-**1.1.2**添加``toomanyrequestserror``和``conflicterror`
-**1.1.1**添加manifest.in
-**1.1.0**支持每个请求头