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.
- Create and manage virtual cards
- Handle recurring card operations
- Track transactions
- Expense management
For detailed API documentation, please visit our Stoplight documentation.
pip install paywithextend
git clone https://github.com/paywithextend/extend-python.git
cd extend-python
pip install -e .
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())
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
-
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
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.
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
This project is licensed under the MIT License - see the LICENSE file for details.
- Extend API Documentation
- httpx for async HTTP requests