Tourist eSIM Python SDK
Official Python SDK for Tourist eSIM Partner API. Enable easy integration for resellers and partners to manage eSIM plans, orders, and customer data.
Features
- 🔐 OAuth 2.0 Authentication - Secure Client Credentials flow with automatic token refresh
- 🚀 Auto-Retry Logic - Exponential backoff with 3 retry attempts on connection failures
- 📦 Type-Supported - Full type hints throughout the SDK
- 💾 Token Caching - In-memory token cache to reduce OAuth requests
- ⚡ Pythonic API - Clean, intuitive API design following Python conventions
- 🔄 Pagination Support - Built-in pagination for catalog queries
- 🎯 Exception Hierarchy - Specific exceptions for different error scenarios
Requirements
- Python 3.8+
- requests >= 2.28.0
Testing
Run the included test script to verify SDK functionality:
python3 test_sdk.py
This runs basic tests for SDK import, instantiation, structure, and resource modules without making actual API calls.
Installation
pip install touristesim-python-sdk
Quick Start
from touristesim import TouristEsim
sdk = TouristEsim('your-client-id', 'your-client-secret')
# Fetch all plans
plans = sdk.plans().get()
for plan in plans:
print(f"{plan.get('name')} - {plan.get('price')} {plan.get('currency')}")
API Usage
Plans
# Get all plans with filters
plans = sdk.plans().get({
'country': 'US',
'type': 'global',
'per_page': 50,
'sort_by': 'price'
})
# Get single plan by slug
plan = sdk.plans().find('vietnam_100mb_7days_7e87c5')
# Get plans by country
us_plans = sdk.plans().by_country('US')
# Get global plans
global_plans = sdk.plans().global_plans()
# Validate plan
validation = sdk.plans().validate('vietnam_100mb_7days_7e87c5', 5)
Countries
# Get all countries
countries = sdk.countries().all()
# Find by code
usa = sdk.countries().find('US')
# Search countries
asian = sdk.countries().search('china')
# Featured countries
featured = sdk.countries().featured()
Orders
# Create order
order = sdk.orders().create({
'plans': [{'plan_slug': 'vietnam_100mb_7days_7e87c5', 'quantity': 1}],
'customer': {'email': 'customer@example.com', 'name': 'Jane Doe'},
})
# Get orders
orders = sdk.orders().all()
# Get single order by order number
order = sdk.orders().find('PO-260519MKAUVE')
# To request a cancellation or refund, contact Tourist eSIM support
eSIMs
# Get eSIMs
esims = sdk.esims().all()
# Find eSIM
esim = sdk.esims().find('8955001000000000000')
# Check usage
usage = sdk.esims().usage('8955001000000000000')
# Get topup packages
packages = sdk.esims().topup_packages('8955001000000000000')
# Purchase topup
sdk.esims().topup('8955001000000000000', 789)
# Send setup email
sdk.esims().send_email('8955001000000000000', 'user@example.com')
Error Handling
from touristesim.exceptions import (
AuthenticationException,
ValidationException,
RateLimitException,
ResourceNotFoundException
)
try:
plan = sdk.plans().find('nonexistent_plan_slug')
except AuthenticationException as e:
print('Auth failed:', e)
except ValidationException as e:
print('Validation errors:', e.get_errors())
except RateLimitException as e:
print('Rate limited. Retry after:', e.get_retry_after(), 'seconds')
except ResourceNotFoundException as e:
print('Not found:', e)
API Documentation
For complete API documentation, visit:
- API Docs: https://docs.touristesim.net/
- SDK Guides: https://docs.touristesim.net/sdks/guides
- Partner Dashboard: https://partners.touristesim.net
Support
For issues or questions:
- Technical Support: tech@touristesim.net
- GitHub Issues: https://github.com/touristesim/touristesim-python-sdk/issues
- Dashboard: https://partners.touristesim.net
License
MIT - see LICENSE file
Metadata
Release files for touristesim-python-sdk 1.2.0
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 |
|---|---|---|---|---|
| touristesim_python_sdk-1.2.0.tar.gz | 13.7 kB | Without provenance | Details for touristesim_python_sdk-1.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| touristesim_python_sdk-1.2.0-py3-none-any.whl | Python 3 | none | any | Details for touristesim_python_sdk-1.2.0-py3-none-any.whl |
Total release size: 28.1 kB
Release files / touristesim_python_sdk-1.2.0.tar.gz
| Download URL | touristesim_python_sdk-1.2.0.tar.gz |
|---|---|
| Size | 13.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eaa9f58b9f75dff37d72e36ee9c234f4e81cc34b92265e2d53f52b5434997585
|
|
BLAKE2b-256 checksum How to use checksums |
e8de16c1de90cf571e83b51f50e2afc04247d63c3cb811cafe9fb3e57fe195e0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Release files / touristesim_python_sdk-1.2.0-py3-none-any.whl
| Download URL | touristesim_python_sdk-1.2.0-py3-none-any.whl |
|---|---|
| Size | 14.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c2255f3f052df7ee86cb419ff4be66f343ed6e99cdac4d87e37da4d6e547b1ba
|
|
BLAKE2b-256 checksum How to use checksums |
ec350fd7a0d758b65190cb0cb9fef9c65bf348b627f87088f24d2da628aa93b3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.11
|
Security for touristesim-python-sdk 1.2.0
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.