diff --git a/src/fsrapiclient/api.py b/src/fsrapiclient/api.py index 36051f5..216c2a4 100644 --- a/src/fsrapiclient/api.py +++ b/src/fsrapiclient/api.py @@ -331,7 +331,7 @@ def common_search(self, search_str: str) -> FsrApiResponse: >>> client.common_search(urlencode({'q': 'Hastings Direct', 'type': 'firm'})) """ - url = f'{FSR_API_CONSTANTS.BASEURL.value}/{self.api_version}/Search?{search_str}' + url = f'{FSR_API_CONSTANTS.BASEURL.value}/Search?{search_str}' try: return FsrApiResponse(self.api_session.get(url)) @@ -564,8 +564,6 @@ def _get_resource_info(self, resource_ref_number: str, resource_type: str, modif url = ( f'{FSR_API_CONSTANTS.BASEURL.value}' '/' - f'{self.api_version}' - '/' f'{resource_endpoint_base}' '/' f'{resource_ref_number}' @@ -1587,8 +1585,6 @@ def get_regulated_markets(self) -> FsrApiResponse: url = ( f'{FSR_API_CONSTANTS.BASEURL.value}' '/' - f'{self.api_version}' - '/' 'CommonSearch' '?' f'{urlencode({"q": "RM"})}' diff --git a/src/fsrapiclient/constants.py b/src/fsrapiclient/constants.py index d5ca84f..8760e7f 100644 --- a/src/fsrapiclient/constants.py +++ b/src/fsrapiclient/constants.py @@ -16,16 +16,16 @@ class FSR_API_CONSTANTS(Enum): Examples -------- - >>> FSR_API_CONSTANTS.BASEURL.value - 'https://register.fca.org.uk/services' >>> FSR_API_CONSTANTS.API_VERSION.value 'V0.1' + >>> FSR_API_CONSTANTS.BASEURL.value + 'https://register.fca.org.uk/services/V0.1' >>> FSR_API_CONSTANTS.RESOURCE_TYPES.value {'firm': {'type_name': 'firm', 'endpoint_base': 'Firm'}, 'fund': {'type_name': 'fund', 'endpoint_base': 'CIS'}, 'individual': {'type_name': 'individual', 'endpoint_base': 'Individuals'}} """ - BASEURL = 'https://register.fca.org.uk/services' API_VERSION = 'V0.1' + BASEURL = f'https://register.fca.org.uk/services/{API_VERSION}' RESOURCE_TYPES = { 'firm': {'type_name': 'firm', 'endpoint_base': 'Firm'}, 'fund': {'type_name': 'fund', 'endpoint_base': 'CIS'}, diff --git a/tests/units/test_constants.py b/tests/units/test_constants.py index 728e12c..15f3b2f 100644 --- a/tests/units/test_constants.py +++ b/tests/units/test_constants.py @@ -11,8 +11,8 @@ class TestFsrApiConstants: def test_fsr_api_constants(self): - assert FSR_API_CONSTANTS.BASEURL.value == 'https://register.fca.org.uk/services' assert FSR_API_CONSTANTS.API_VERSION.value == 'V0.1' + assert FSR_API_CONSTANTS.BASEURL.value == 'https://register.fca.org.uk/services/V0.1' assert FSR_API_CONSTANTS.RESOURCE_TYPES.value == { 'firm': {'type_name': 'firm', 'endpoint_base': 'Firm'}, 'fund': {'type_name': 'fund', 'endpoint_base': 'CIS'},