From 4deaa4baadfe7616cb71928c3329062dc15c291e Mon Sep 17 00:00:00 2001 From: Justin Kumpe Date: Sun, 29 Jun 2025 10:43:34 -0500 Subject: [PATCH 1/2] added option for sandbox --- mercury_bank_api/mercury_client.py | 9 ++++++--- setup.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/mercury_bank_api/mercury_client.py b/mercury_bank_api/mercury_client.py index 42dbc5c..cec7b38 100644 --- a/mercury_bank_api/mercury_client.py +++ b/mercury_bank_api/mercury_client.py @@ -28,9 +28,10 @@ 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. @@ -38,6 +39,8 @@ def __init__(self, api_token: str, timeout: int = 30): 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() @@ -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( diff --git a/setup.py b/setup.py index 77ecd89..2e7bb65 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,6 @@ The main configuration is in pyproject.toml. """ -from setuptools import setup +from setuptools import setup # type: ignore setup() From 94c9b5e400bad41891ad8200b14eba0048dbc2cc Mon Sep 17 00:00:00 2001 From: Justin Kumpe Date: Sun, 29 Jun 2025 10:46:21 -0500 Subject: [PATCH 2/2] bump version number --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 8ab7349..cb56829 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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"