Official Python SDK for Billingrails API
Project description
Billingrails Python SDK
Official Python SDK for Billingrails
Installation
pip install billingrails
Quick Start
from billingrails import Billingrails
# Initialize the client
client = Billingrails(
api_key="your-api-key",
base_url="https://api.billingrails.com"
)
# List accounts
list_response = client.accounts.list()
print(list_response["accounts"])
# Create an account
create_response = client.accounts.create({
"name": "John Doe",
"email": "john@example.com",
"country": "US",
"default_currency": "USD"
})
print(create_response["account"])
# Retrieve an account
retrieve_response = client.accounts.retrieve("acc_123")
print(retrieve_response["account"])
# Update an account
update_response = client.accounts.update("acc_123", {
"name": "Jane Doe"
})
print(update_response["account"])
# Get account balances
balances_response = client.accounts.get_balances("acc_123")
print(balances_response["balances"])
# Debit an account
debit_response = client.accounts.debit("acc_123", {
"amount": 1000, # Amount in cents
"currency": "USD"
})
print(debit_response["balances"])
Configuration
Basic Configuration
client = Billingrails(api_key="your-api-key")
Advanced Configuration
client = Billingrails(
api_key="your-api-key",
base_url="https://api.billingrails.com",
timeout=30, # Request timeout in seconds
max_retries=3 # Maximum number of retries for failed requests
)
Error Handling
from billingrails import Billingrails
import requests
client = Billingrails(api_key="your-api-key")
try:
retrieve_response = client.accounts.retrieve("acc_123")
except requests.exceptions.HTTPError as e:
print(f"HTTP error occurred: {e}")
except requests.exceptions.RequestException as e:
print(f"Error occurred: {e}")
License
MIT - See LICENSE file for details
Support
For support, please contact ugo@billingrails.com or visit our documentation.
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
billingrails-0.1.4.tar.gz
(21.5 kB
view details)
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 billingrails-0.1.4.tar.gz.
File metadata
- Download URL: billingrails-0.1.4.tar.gz
- Upload date:
- Size: 21.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef1dcba3488e7b6292e9878e9b9e209ab934cc2df5e7bb6ca4d797ca1df7a0d1
|
|
| MD5 |
342772c2df42e5906758c3e9870d83df
|
|
| BLAKE2b-256 |
5b865b4837b59b7850f9cc202b67f9f75f3213e0f3025d2e76c5cfb8dac931f1
|
File details
Details for the file billingrails-0.1.4-py3-none-any.whl.
File metadata
- Download URL: billingrails-0.1.4-py3-none-any.whl
- Upload date:
- Size: 63.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c03a6dfb48f3c2e4969a24f2213b0a57ecc9474ecb5502ef2ee64c2d990494b6
|
|
| MD5 |
4913a836194fbb30bd2ebbdaf48b03e1
|
|
| BLAKE2b-256 |
9ea89153ae99f4509c8cef345570b390544695f260b160338549a4312806e841
|