Stripe Twisted bindings
Installation
> pip install txstripe
Usage
Works exactly like stripe-python except each blocking method returns a Deferred.
Examples
In the REPL
$ python -m twisted.conch.stdio
>>> import txstripe
>>> txstripe.api_key = 'ABC123'
>>> txstripe.Customer.all()
<Deferred #0>
Deferred #0 called back: <ListObject list at 0x7f81ddb55eb0> JSON: {
"data": [
{
"account_balance": 0,
"created": 1441869100,
"currency": "usd",
"default_source": "card_123456",
"delinquent": false,
"description": "Customer for Bill",
"discount": null,
"email": "bill@gmail.com",
"id": "cus_blah",
"livemode": false,
"metadata": {},
"object": "customer",
"shipping": null,
"sources": {
#...
In code
from twisted.internet import reactor
from twisted.internet import defer
import txstripe
txstripe.api_key = 'ABC123'
@defer.inlineCallbacks
def print_customers_and_subs():
customer = yield txstripe.Customer.all()
print customer
if __name__ == "__main__":
deferred = print_customers_and_subs()
deferred.addErrback(lambda err: err.printTraceback())
deferred.addCallback(lambda _: reactor.stop())
reactor.run()
Changelog
0.1.0
- Bump Stripe version to 1.51.0.
0.0.7 (unreleased)
- Use api encode method to build requests.
0.0.6
- Fix capture end point.
- Test coverage.
0.0.5
- Fix bug with
create
method not sending up params.
0.0.4
- Ensure urls passed to Treq are bytes, not unicode.
- Test coverage.
0.0.3
- First working version.
License
MIT. As per original project.