Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions mercury_bank_api/mercury_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,19 @@ class MercuryBankAPIClient:
transactions = client.get_transactions(account_id="account_123")
"""

BASE_URL = "https://api.mercury.com/api/v1"
base_url = "https://api.mercury.com/api/v1"
SANDBOX_BASE_URL = "https://api-sandbox.mercury.com/api/v1"

def __init__(self, api_token: str, timeout: int = 30):
def __init__(self, api_token: str, timeout: int = 30, sandbox: bool = False):
"""
Initialize the Mercury Bank API client.

Args:
api_token: Your Mercury API token
timeout: Request timeout in seconds (default: 30)
"""
if sandbox:
self.base_url = self.SANDBOX_BASE_URL
self.api_token = api_token
self.timeout = timeout
self.session = requests.Session()
Expand Down Expand Up @@ -76,7 +79,7 @@ def _make_request(
Raises:
MercuryBankAPIError: If the API request fails
"""
url = urljoin(self.BASE_URL + "/", endpoint.lstrip("/"))
url = urljoin(self.base_url + "/", endpoint.lstrip("/"))

try:
response = self.session.request(
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "mercury_bank_api"
version = "1.0.0"
version = "1.0.2"
description = "A comprehensive Python client for the Mercury Bank API"
readme = "README.md"
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
The main configuration is in pyproject.toml.
"""

from setuptools import setup
from setuptools import setup # type: ignore

setup()
Loading