From 4817da2b6f85b74b0361f8baa874c53c19d9edc3 Mon Sep 17 00:00:00 2001 From: Thomas Vriens Date: Tue, 24 Jan 2023 10:14:38 +0100 Subject: [PATCH 1/2] Update __init__.py Add support for different domains, the transip api does not work across domains. If you have a .be account you can not use the .nl api endpoint. --- transip/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/transip/__init__.py b/transip/__init__.py index 57d808a..5c4ad4e 100644 --- a/transip/__init__.py +++ b/transip/__init__.py @@ -56,6 +56,7 @@ class TransIP: TransIP API global_key (bool): Allow the access token to be used from all IP-addresses instead of only the whitelisted ones. + transip_domain_extension (str): supply a different transip domain to use as api endpoint, possible options: .eu, .be, .nl (default). """ def __init__( @@ -66,9 +67,10 @@ def __init__( private_key: Optional[str] = None, private_key_file: Optional[str] = None, global_key: bool = False, + transip_domain_extension: str = ".nl", ) -> None: self._api_version: str = api_version - self._url: str = f"https://api.transip.nl/v{api_version}" + self._url: str = f"https://api.transip.{transip_domain_extension}/v{api_version}" # Headers to use when making a request to TransIP self.headers: Dict[str, str] = { From 5a88d5095eefa64e8568eb25b0bab969b1d27bfe Mon Sep 17 00:00:00 2001 From: Thomas Vriens Date: Tue, 24 Jan 2023 10:20:30 +0100 Subject: [PATCH 2/2] Update __init__.py remove extra dot --- transip/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/transip/__init__.py b/transip/__init__.py index 5c4ad4e..8b9422c 100644 --- a/transip/__init__.py +++ b/transip/__init__.py @@ -56,7 +56,7 @@ class TransIP: TransIP API global_key (bool): Allow the access token to be used from all IP-addresses instead of only the whitelisted ones. - transip_domain_extension (str): supply a different transip domain to use as api endpoint, possible options: .eu, .be, .nl (default). + transip_domain_extension (str): supply a different transip domain to use as api endpoint, possible options: eu, be, nl (default). """ def __init__( @@ -67,7 +67,7 @@ def __init__( private_key: Optional[str] = None, private_key_file: Optional[str] = None, global_key: bool = False, - transip_domain_extension: str = ".nl", + transip_domain_extension: str = "nl", ) -> None: self._api_version: str = api_version self._url: str = f"https://api.transip.{transip_domain_extension}/v{api_version}"