Cuenca API Client
Project description
Cuenca – Python client library
Transfers
Create transfer
import cuenca
cuenca.configure(sandbox=True) # if using sandbox
local_transfer_id = '078efdc20bab456285437309c4b75673'
transfer = cuenca.Transfer.create(
recipient_name='Benito Juárez',
account_number='646180157042875763',
amount=12345, # Mx$123.45
descriptor='sending money', # As it'll appear for the customer
idempotency_key=local_transfer_id
)
# To get updated status
transfer.refresh()
Retrieve by id
import cuenca
transfer = cuenca.Transfer.retrieve('tr_123')
Query by idempotency_key
, account_number
and status
Results are always returned in descending order of created_at
The methods that can be used:
one()
- returns a single result. RaisesNoResultFound
if there are no results andMultipleResultsFound
if there are more than onefirst()
- returns the first result orNone
if there aren't anyall()
- returns a generator of all matching results. Pagination is handled automatically as you iterate over the responsecount()
- returns an integer with the count of the matching results
import cuenca
from cuenca.types import Status
# find the unique transfer using the idempotency key
local_transfer_id = '078efdc20bab456285437309c4b75673'
transfer = cuenca.Transfer.one(idempotency_key=local_transfer_id)
# returns a generator of all succeeded transfers to the specific account
transfers = cuenca.Transfer.all(
account_number='646180157000000004',
status=Status.succeeded
)
# the total number of succeeded transfers
count = cuenca.Transfer.count(status=Status.succeeded)
Api Keys
Create new ApiKey
and deactivate old
import cuenca
# Create new ApiKey
new = cuenca.ApiKey.create()
# Have to use the new key to deactivate the old key
old_id = cuenca.session.auth[0]
cuenca.session.configure(new.id, new.secret)
cuenca.ApiKey.deactivate(old_id, 60) # revoke prior API key in an hour
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cuenca-0.1.3.tar.gz
(8.1 kB
view details)
Built Distribution
cuenca-0.1.3-py3-none-any.whl
(13.2 kB
view details)
File details
Details for the file cuenca-0.1.3.tar.gz
.
File metadata
- Download URL: cuenca-0.1.3.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | be187593c3aa605bb0083ac0d4fb98ec2bf8d02484a4f935d88c93f61dcb7ef0 |
|
MD5 | 22c6e49296ea52ce9bb300ed41c32b51 |
|
BLAKE2b-256 | 61e87f8889336fbf1d25e5ee226e95bd68ff3d5dc08fb9156cc59b8cd2be8516 |
File details
Details for the file cuenca-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: cuenca-0.1.3-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.7.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa572ee94ba84a3e34ee47df5da682ae9346d9377087a654a18c6e4503f75761 |
|
MD5 | a8e08cf79f535053f6f363495478cdee |
|
BLAKE2b-256 | 8374579a26b2403c7a3097ad5c020e0d24998afbe34a56fffcb3c2447346fee7 |