Installation
Requirements
- Python: 3.11 or higher
- Package Manager: pip or poetry
Install via pip
pip install sniperouteInstall via poetry
poetry add sniperouteInstall from Source
git clone https://github.com/alibrahim/sniperoute-sdk-python.git
cd sniperoute-sdk-python
pip install -e .Verify Installation
import sniperoute
print(sniperoute.__version__) # Should print version numberDependencies
The SDK automatically installs these dependencies:
| Package | Version | Purpose |
|---|---|---|
httpx | >= 0.26.0 | Async HTTP client |
pydantic | >= 2.5.0 | Data validation and serialization |
python-dotenv | >= 1.0.0 | Environment variable management |
Optional Dependencies
Development
For development and testing:
pip install sniperoute[dev]Includes:
pytest- Testing frameworkpytest-cov- Coverage reportingpytest-asyncio- Async test supportmypy- Type checkingruff- Linting and formatting
Type Checking
For type stubs:
pip install sniperoute[types]Environment Setup
1. Create .env File
touch .env2. Add Credentials
# .env
SNIPEROUTE_API_KEY=sk_live_your_api_key_here
SNIPEROUTE_API_URL=https://api.sniperoute.io3. Load Environment Variables
The SDK automatically loads .env files using python-dotenv:
from sniperoute import SnipeRouteClient
# Automatically uses SNIPEROUTE_API_KEY and SNIPEROUTE_API_URL
client = SnipeRouteClient()⚠️
Never commit .env files to version control. Add .env to your .gitignore.
Virtual Environment Setup
Using venv
# Create virtual environment
python -m venv venv
# Activate (Linux/macOS)
source venv/bin/activate
# Activate (Windows)
venv\Scripts\activate
# Install SDK
pip install sniperouteUsing poetry
# Create project
poetry new my-trading-app
cd my-trading-app
# Add SDK
poetry add sniperoute
# Activate shell
poetry shellIDE Setup
VS Code
Install Python extension and add to .vscode/settings.json:
{
"python.linting.enabled": true,
"python.linting.mypyEnabled": true,
"python.formatting.provider": "black"
}PyCharm
- Go to Settings → Project → Python Interpreter
- Add
sniperoutepackage - Enable Type Checking in settings
Troubleshooting
ModuleNotFoundError: No module named 'sniperoute'
Problem: SDK not installed in current environment
Solution:
# Verify you're in correct virtual environment
which python
# Reinstall SDK
pip install sniperouteImportError: cannot import name 'SnipeRouteClient'
Problem: Outdated SDK version
Solution:
# Upgrade to latest version
pip install --upgrade sniperouteTypeError: 'Decimal' object is not iterable
Problem: Missing decimal import
Solution:
from decimal import Decimal
quantity = Decimal("10") # Not: 10httpx.ConnectError: Connection refused
Problem: Invalid API URL
Solution:
# Check .env file
SNIPEROUTE_API_URL=https://api.sniperoute.io # CorrectUpgrade
Upgrade to Latest Version
pip install --upgrade sniperouteUpgrade to Specific Version
pip install sniperoute==1.2.0Check Current Version
import sniperoute
print(sniperoute.__version__)Uninstall
pip uninstall sniperoute