Python client for the Extend API
Project description
extend-python
Python library for the Extend API
A Python client for the Extend API, providing a simple and intuitive interface for managing virtual cards, transactions, and more.
Features
- Create and manage virtual cards
- Handle recurring card operations
- Track transactions
- Expense management
Documentation
For detailed API documentation, please visit our Stoplight documentation.
Installation
From PyPI
pip install paywithextend
From Source
git clone https://github.com/paywithextend/extend-python.git
cd extend-python
pip install -e .
Quick Start
import asyncio
from extend import ExtendClient
async def main():
# Initialize the client
client = ExtendClient(
api_key="your-api-key",
api_secret="your-api-secret"
)
# Get all virtual cards
response = await client.virtual_cards.get_virtual_cards()
print("Virtual Cards:", response["virtualCards"])
# Get all transactions
response = await client.transactions.get_transactions()
print("Transactions:", response["report"]["transactions"])
# Run the async function
asyncio.run(main())
Environment Variables
The following environment variables are required for integration tests and examples:
EXTEND_API_KEY: Your Extend API keyEXTEND_API_SECRET: Your Extend API secretEXTEND_TEST_RECIPIENT: Email address for test card recipientEXTEND_TEST_CARDHOLDER: Email address for test cardholder
Development Setup
-
Clone the repository:
git clone https://github.com/paywithextend/extend-python.git cd extend-python
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install development dependencies:
pip install -e ".[dev]"
-
Run tests:
# Run all tests pytest # Run only unit tests pytest tests/test_client.py # Run only integration tests pytest tests/test_integration.py
Testing
The project includes both unit tests and integration tests:
- Unit tests (
tests/test_client.py): Test the client's internal logic and validation - Integration tests (
tests/test_integration.py): Test actual API interactions - Example notebook (
notebooks/api_testing.ipynb): Interactive examples
To run integration tests, make sure you have set up the required environment variables.
Contributing
We welcome contributions from the community!
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Extend API Documentation
- httpx for async HTTP requests
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file paywithextend-1.2.2.tar.gz.
File metadata
- Download URL: paywithextend-1.2.2.tar.gz
- Upload date:
- Size: 15.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f0866bda7fffa174a094b85f4aec3d353d3104c0c6e9b8d115a2a6156489a0f1
|
|
| MD5 |
53ad7ab54100d3d5de57685ffbfeef17
|
|
| BLAKE2b-256 |
dddc27bff771cace5d83cd3a52220ed8b99bc09f0e0a4b8abca323d1b214f643
|
File details
Details for the file paywithextend-1.2.2-py3-none-any.whl.
File metadata
- Download URL: paywithextend-1.2.2-py3-none-any.whl
- Upload date:
- Size: 22.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
630f1551ec824c2c2e545111f3fef23474163cb0c4d186c7e93b97e5a38020b0
|
|
| MD5 |
9686f42197aa5a367e74d57dfaea68a0
|
|
| BLAKE2b-256 |
c241789e1d78948d76f86d1adf016e87c4daf769c12dcc2fc62e4b4b2f73cad8
|