EPS Python SDK
Backend-only Python client for Eko Platform Services APIs — DMT, AePS, BBPS, KYC and verification — with HMAC request signing built in.
pip install eps-sdk
from eps_sdk import EpsClient
client = EpsClient(
developer_key="<your_developer_key>",
access_key="<your_access_key>",
environment="sandbox", # or "production"
initiator_id="9962981729", # registered mobile of the API user
user_code="20810200", # retailer/agent code
timeout=30.0, # whole-request budget in seconds (default)
)
sender = client.call("dmt-get-sender", {"customer_id": "9123456789"})
One generic call(slug, params) covers every endpoint. The slug list, each
endpoint's params and which of them are required all come from the same
generated API surface the docs are built from, so the client validates your
input before it signs and sends anything.
That surface is pinned to the SDK release: a newly launched API returns
"Unknown endpoint slug" until you upgrade (pip install -U eps-sdk).
timeout is the whole-request budget in seconds, defaulting to 30.0 — the
same 30s every EPS SDK defaults to. (Node names its knob timeout_ms /
timeoutMs because it is milliseconds there.) The response and error contract
is shared by all five SDKs; see
docs/sdk-golden-vector.md.
Backend only
access_key signs every request. Never run this in anything a browser can
reach — a leaked access key lets anyone transact as you.
What it does for you
- Signs the request —
secret-key,secret-key-timestampanddeveloper_keyheaders on every call. - Validates first — missing required params and wrong types raise
EpsErrorbefore a request goes out. - Routes the params — path tokens, query string, JSON body, or
multipart/form-datafor file-upload endpoints, per the endpoint's spec. - Fails loudly — a non-2xx response raises
EpsHttpError(with the decoded envelope on.body); a non-JSON body raises rather than returning{}. - Never loses a transaction — every non-GET call carries a
client_ref_id(yours, or a generated 15-char one). A money-moving call that times out (or gets back an unreadable response) is looked up by that ref (or, on a refund, which has no ref, by itstid) and surfaced asEpsIndeterminateErrorwith the inquiry result attached, never silently re-sent. - Retries the safe things — a call that times out or gets a 429/5xx or an unreadable 2xx is retried with jittered backoff (
retries, default 2) only when the endpoint is markedretrySafe(idempotent, free, moves no money). Paid lookups and money-moving calls are never re-sent. - Validates values too — spec-driven format / enum / range / length rules (dates, PAN, IFSC,
client_ref_id…) fail before the request is signed. Aclient_ref_idyou pass to a money-moving call must not be blank (whitespace, incl. no-break and zero-width spaces) — it is the only key a lost response can be reconciled by.
Files can be a path or an in-memory pair:
client.call("activate-aeps-fingpay", {
"pan_card": "/path/to/pan.jpg",
"aadhar_front": ("aadhar.jpg", image_bytes),
# ...
})
Reconciling an indeterminate transaction:
from eps_sdk import EpsIndeterminateError
try:
client.call("bbps-pay-bill", {...})
except EpsIndeterminateError as err:
# err.client_ref_id — persist it; err.status_check["data"]["tx_status"]:
# "0" success, "1" fail, "2" awaited. Inquire again later with
# client.call("transaction-inquiry", {"client_ref_id": err.client_ref_id})
...
Knobs: retries (2), retry_base_delay (0.2 s), auto_status_check (True). Off skips only the
inquiry — a financial call still fails with the indeterminate error carrying
its ref (or tid).
Debugging
Debug mode shows what the SDK sends and receives: the environment, the full URL, headers, body, HTTP status, the raw EPS response, validation failures, retries and the automatic status check. Each event is one JSON object per line. Turn it on when a call misbehaves and share the output with Eko support instead of just the response body.
No code change: set the env var and rerun.
EPS_SDK_DEBUG=1 python app.py
Or in code:
EpsClient(..., debug=True) # JSON lines on stderr
EpsClient(..., debug=lambda event: log.debug(event)) # your logger (event is a dict)
EpsClient(..., debug=False) # off, even when EPS_SDK_DEBUG is set
A request line looks like this:
{"logger":"eps-sdk","ts":"2026-11-23T11:31:25.884Z","event":"request","sdk":"python","sdk_version":"3.1.0","surface":"48eb0cf2","env":"sandbox","call_id":"f020eef5","slug":"bbps-operator-code-circle","attempt":1,"method":"GET","url":"https://staging.eko.in/ekoapi/v3/customer/payment/bbps/recharge/****3210/operator?initiator_id=****1729","headers":{"developer_key":"****wxyz","secret-key":"****","secret-key-timestamp":"1763897485884","content-type":"application/json"},"body":null}
Events: init (once per client), request and response (per attempt),
transport_error (no usable response), retry, and error (the call threw;
a validation failure has no request before it, so nothing was sent). Lines of
one call share a call_id.
What is masked: developer_key shows its last 4 characters and secret-key is
hidden. Aadhaar, PAN, account and mobile numbers show their last 4. OTPs,
biometrics, names, addresses, e-mails, dates of birth and any field the SDK does
not recognise print as ****. Ids, status codes, amounts and the EPS message
print as-is so support can trace the call. Debug mode never changes a call's
outcome, and costs nothing while off.
⚠️ Masking is best-effort. Free text (upstream error pages, messages) is scrubbed but may still contain credentials or personal data, and id and status fields print as-is. Review the output before sharing it, share it only with Eko support, and turn debug mode off when you are done.
The format is identical across all five EPS SDKs; see "Debug mode conformance" in docs/sdk-golden-vector.md.
Zero dependencies
Standard library only (urllib, hmac, json). Nothing to keep patched.
Development
The runtime asset data/sdk-surface.json is generated from the API specs, not
committed. From the repo root:
npm run build # bakes data/sdk-surface.json
cd packages/sdk-python
PYTHONPATH=src python3 -m unittest discover -s tests
The test suite is the cross-language conformance suite described in
docs/sdk-golden-vector.md — the same cases the Node.js and PHP SDKs must pass.
MIT licensed.
Metadata
Release files for eps-sdk 3.0.16
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 | Actions |
|---|---|---|---|---|
| eps_sdk-3.0.16.tar.gz | 41.1 kB | With provenance | Details for eps_sdk-3.0.16.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| eps_sdk-3.0.16-py3-none-any.whl | Python 3 | none | any | Details for eps_sdk-3.0.16-py3-none-any.whl |
Total release size: 71.7 kB
Release files / eps_sdk-3.0.16.tar.gz
| Download URL | eps_sdk-3.0.16.tar.gz |
|---|---|
| Size | 41.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1f441f93f6ce4e9d1150f5740355588a387b96941be38efc0170b122c6632880
|
|
BLAKE2b-256 checksum How to use checksums |
79521d10590f943614612cf9ee9f2d674489ff6e5d6d6485035f73a99ff07cd1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logRelease files / eps_sdk-3.0.16-py3-none-any.whl
| Download URL | eps_sdk-3.0.16-py3-none-any.whl |
|---|---|
| Size | 30.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
da28ea80ce9a94abb323b71830156c64078406af0288a3479dd26e9b53e8c1b2
|
|
BLAKE2b-256 checksum How to use checksums |
1c4970202da791b0e84e2d0a698c0e80dbf514d976ef337c6e48068372db88ef
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logSecurity for eps-sdk 3.0.16
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for eps_sdk-3.0.16.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.
Transparency logA 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.