Cuenca API Client
Project description
Cuenca – Python client library
Transfers
Create transfer
import cuenca
cuenca.configure(sandbox=True) # if using sandbox
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='unique string',
)
# To get updated status (estado)
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
transfer = cuenca.Transfer.one(idempotency_key='unique string')
# 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, minutes)
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.0.tar.gz
(8.0 kB
view details)
Built Distribution
cuenca-0.1.0-py3-none-any.whl
(13.0 kB
view details)
File details
Details for the file cuenca-0.1.0.tar.gz
.
File metadata
- Download URL: cuenca-0.1.0.tar.gz
- Upload date:
- Size: 8.0 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 | 82e76fb4ab980fdc555a6fdb848d69343464be9a06c4f64945ee9efbd4adb215 |
|
MD5 | 931763cbc8a6a4eadb5a585c079e81fa |
|
BLAKE2b-256 | 060864d688f24664f73578c6960db505f1a0dd1ff8e756c3be828c1a63e7156e |
File details
Details for the file cuenca-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: cuenca-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.0 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 | 61afa8fbc31157cf702d943a2732028b0bf8514751633e2f12c4894a1f5b535c |
|
MD5 | 6cb0fc895f578d52a5ef87e2e1f38727 |
|
BLAKE2b-256 | 172a4e1a0b77105d2833cf6de520b4ffaecaff7665ad01524fcd01d19880caa9 |