This release is a pre-release and may not be stable for production use.
Cuenca – Python client library
Installation
pip install cuenca
Authentication
The preferred way to configure the credentials for the client is to set the
CUENCA_API_KEY and CUENCA_API_SECRET environment variables. The client
library will automatically configure based on the values of those variables.
To configure manually:
import cuenca
cuenca.configure(api_key='PKxxxx', api_secret='yyyyyy')
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', # CLABE or card number
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. RaisesNoResultFoundif there are no results andMultipleResultsFoundif there are more than onefirst()- returns the first result orNoneif 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
Metadata
Release files for cuenca 0.4.2.dev0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| cuenca-0.4.2.dev0.tar.gz | 14.9 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| cuenca-0.4.2.dev0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.1 kB
Release files / cuenca-0.4.2.dev0.tar.gz
| Download URL | cuenca-0.4.2.dev0.tar.gz |
|---|---|
| Size | 14.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f266f09b57934a55913fe910962594a4a56ac17f7e294c4b7e034c1cc2465823
|
|
BLAKE2b-256 checksum How to use checksums |
83604bba57d0c303c7e3ccb49bed339e5339df5da494751d32552673986c4cc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6
|
Release files / cuenca-0.4.2.dev0-py3-none-any.whl
| Download URL | cuenca-0.4.2.dev0-py3-none-any.whl |
|---|---|
| Size | 23.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
18aeec774a7cb2025fe2e5e343847bd1c7fc30eec4cd6f92b0961cc0a0828658
|
|
BLAKE2b-256 checksum How to use checksums |
3c6d8cda069ee797ec3b7b40c8d7f341dd2f610b55650dc6b91858aed890f03c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6
|
Security for cuenca 0.4.2.dev0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.