This release is a pre-release and may not be stable for production use.
SMSPVA Python SDK
Python 3.10+, synchronous SMSPVA and asynchronous AsyncSMSPVA, with the same 56 typed methods. Covers Activation V2 (20), Rental (22) and Private Email (14). Alternative API is excluded. This is an alpha release. PyPI publication is pending.
Install from source:
git clone https://github.com/SMSPVA/smspva-python.git
cd smspva-python
python -m pip install .
import os
from smspva import SMSPVA
with SMSPVA(os.environ["SMSPVA_API_KEY"]) as client:
print(client.activation.get_balance())
print(client.rental.get_countries())
print(client.email.get_providers())
import asyncio
import os
from smspva import AsyncSMSPVA
async def main():
async with AsyncSMSPVA(os.environ["SMSPVA_API_KEY"]) as client:
result = await client.activation.get_balance()
print(result)
asyncio.run(main())
Use the client as a context manager, or call close() / await aclose() yourself. Async uses HTTPX AsyncClient, not worker threads.
Requests and results
- Activation V2 sends the key in the
apikeyheader. Rental and Email use theapikeyquery parameter. Public methods send no key or cookies. Optional-key rental methods use the client key unless you passuse_api_key=False. - Returned dictionaries preserve wire field names and values, including string prices, timestamps, and IDs. Types follow the source schemas; a field not marked required remains optional.
is_pending(result)recognises Activation SMS HTTP 202 /SMS_NOT_YET_RECEIVED.is_no_stock(result)recognises Email creationstatus=2. Both return the original response instead of raising a generic error.- All documented optional parameters are available, including
partnerkey,partner_key,provider,extend, pagination and search. Query and path values are encoded. Emailpcode=Noneorpcode=""is omitted entirely. rental.get_multi_service_countrequires explicitdtypeanddcountbecause the docs warn that backend defaults are unreliable. The wire method remainsget_count_multi.
# Public reference data, without an API key.
with SMSPVA() as client:
services = client.email.get_data(pcode="CODE_FROM_GET_PROVIDERS")
Paid example (run only when you intend to create a rental):
from smspva import is_no_stock
with SMSPVA(os.environ["SMSPVA_API_KEY"]) as client:
result = client.email.create_order(
scode="CODE_FROM_GET_DATA", dtype="week", dcount=1
)
if is_no_stock(result):
print("No mailbox available; refresh counts before trying again.")
else:
print(result)
Waiting for SMS
Save an expiry once when the number is created. wait_for_sms polls only Receive SMS, never creates another order, and stops on terminal errors, expiry or a transport failure. A new SMS retrieval can trigger payment.
import time
# number_result is the successful response from your own get_number request.
expires_at = time.time() + number_result["data"]["orderExpireIn"]
result = client.activation.wait_for_sms(
orderid=number_result["data"]["orderId"], expires_at=expires_at
)
Use await client.activation.wait_for_sms(...) with AsyncSMSPVA. The helper waits at least five seconds between pending responses; this is a helper policy, not a claim about an API-wide rate limit. Request deadlines are bounded by the saved expiry. HTTPX timeouts apply to individual network operations; the async polling helper also enforces an overall remaining deadline.
Errors and timeouts
ApiError retains family, operation, http_status, code and the original response. ProtocolError means the body was not a usable JSON envelope. TransportError and RequestTimeoutError mean the request outcome may be unknown (outcome_unknown for state-changing/paid methods). No requests are retried automatically; inspect current orders before repeating a paid operation.
Exception messages omit request URLs and keys. Query credentials may still appear if you enable HTTPX request logging; redact those logs. Do not put account keys in browser code.
The default timeout is 30 seconds per HTTPX network operation. Override at client construction or per call with timeout=.... Advanced transports, proxies and test doubles can be supplied through transport=httpx.HTTPTransport(...) or httpx.AsyncHTTPTransport(...); environment proxies/cookies are not inherited. Redirects are never followed.
The generated method index is in METHODS.md. Response TypedDicts and input aliases are available in smspva.types; the package includes py.typed.
License
MIT. See LICENSE.
Development
python -m pip install -e . build mypy
python -m unittest discover -s tests -v
python -m mypy
python -m build
Tests use synthetic fixtures and local transports; they do not buy numbers or call the production API.
Documentation
The new documentation is being prepared in English, Spanish and Chinese. Localized links will be added when it is deployed.
The SDK covers Activation V2, Rental and Private Email. Alternative API is not supported.
Metadata
Release files for smspva-sdk 0.1.0a1
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 | |
|---|---|---|---|---|
| smspva_sdk-0.1.0a1.tar.gz | 23.4 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| smspva_sdk-0.1.0a1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 43.7 kB
Release files / smspva_sdk-0.1.0a1.tar.gz
| Download URL | smspva_sdk-0.1.0a1.tar.gz |
|---|---|
| Size | 23.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
db5bc722a1d79d4a744eb7252a6ff4b548ff976eb6c3ea7963ff8bb979cffe2a
|
|
BLAKE2b-256 checksum How to use checksums |
5f3c0daecadbb87b48b56c8b0c86d5023034a4e1ee410a7c22700be2c0019d21
|
| 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 Oct 26, 2026.
Transparency logRelease files / smspva_sdk-0.1.0a1-py3-none-any.whl
| Download URL | smspva_sdk-0.1.0a1-py3-none-any.whl |
|---|---|
| Size | 20.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9b5a982ea70fe0b2b7c5c3e93a64d60434f18f4b5395d170102b52b6288d7775
|
|
BLAKE2b-256 checksum How to use checksums |
aa3b0d8a18520bf6fc0fc5e5c46368eb7ac0c6b2b1d60f1c8e327be94955db95
|
| 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 Oct 26, 2026.
Transparency logSecurity for smspva-sdk 0.1.0a1
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
All 2 files in this release have been uploaded with provenance metadata.
Attestation for smspva_sdk-0.1.0a1.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 Oct 26, 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.