fca_api.const#
Constants and enumerations for the FCA API client.
This module defines constants, enums, and configuration values used throughout the FCA API client. It provides type-safe access to:
Resource type information for firms, individuals, and funds
API configuration including versions and base URLs
Endpoint mappings for different resource types
The enums provide both type safety and convenient access to API configuration without hardcoding strings throughout the codebase.
Example
Using resource types:
from fca_api.const import ResourceTypes
# Get all supported resource types
all_types = ResourceTypes.all_types()
print(all_types) # ['firm', 'individual', 'fund']
# Get resource info by type name
firm_info = ResourceTypes.from_type_name('firm')
print(firm_info.endpoint_base) # 'Firm'
Using API constants:
from fca_api.const import ApiConstants
print(ApiConstants.API_VERSION.value) # 'V0.1'
print(ApiConstants.BASEURL.value) # 'https://register.fca.org.uk/services/V0.1'
- class fca_api.const.ResourceTypeInfo(type_name: str, endpoint_base: str)[source]#
Information about a specific resource type in the FCA API.
This dataclass stores the mapping between user-friendly type names and the actual API endpoint paths used by the FCA Financial Services Register API.
Example
Creating resource type info:
firm_info = ResourceTypeInfo( type_name='firm', endpoint_base='Firm' ) # Use in URL construction url = f"/V0.1/{firm_info.endpoint_base}/123456"
- __init__(type_name: str, endpoint_base: str) None#
- class fca_api.const.ResourceTypes(*values)[source]#
Enumeration of supported resource types in the FCA API.
This enum provides type-safe access to information about the three main resource types supported by the Financial Services Register API: firms, funds, and individuals.
Each enum member contains a ResourceTypeInfo object with the type name and corresponding API endpoint base path.
Example
Access resource type information:
# Get firm resource info firm_info = ResourceTypes.FIRM.value print(firm_info.type_name) # 'firm' print(firm_info.endpoint_base) # 'Firm' # Use in API calls endpoint = f"/{firm_info.endpoint_base}/123456"
- classmethod all_resource_types() list[ResourceTypeInfo][source]#
Return a list of all resource type info objects.
- Returns:
A list containing ResourceTypeInfo objects for all supported resource types in the API.
Example
Get all resource types:
all_resources = ResourceTypes.all_resource_types() for resource in all_resources: print(f"{resource.type_name} -> {resource.endpoint_base}")
- classmethod all_types() list[str][source]#
Return a list of all resource type names.
- Returns:
A list of lowercase type name strings for all supported resource types.
Example
Get type names for validation:
valid_types = ResourceTypes.all_types() user_input = "firm" if user_input in valid_types: print("Valid resource type")
- classmethod from_type_name(type_name: str) ResourceTypeInfo[source]#
Return the ResourceTypeInfo for the given type name.
- Parameters:
type_name – The lowercase resource type name to look up (e.g., ‘firm’, ‘individual’, ‘fund’).
- Returns:
The corresponding ResourceTypeInfo object.
- Raises:
ValueError – If the type name is not recognized.
Example
Look up resource info by name:
try: info = ResourceTypes.from_type_name('firm') print(f"Endpoint: {info.endpoint_base}") except ValueError: print("Unknown resource type")
- class fca_api.const.ApiConstants(*values)[source]#
API-level constants for the FCA Financial Services Register.
This enum contains configuration constants used throughout the client, including API version, base URLs, and documentation links.
These constants should be used instead of hardcoded strings to ensure consistency and make version updates easier.
Example
Use constants in configuration:
from fca_api.const import ApiConstants print(f"API Version: {ApiConstants.API_VERSION.value}") print(f"Base URL: {ApiConstants.BASEURL.value}") print(f"Documentation: {ApiConstants.DEVELOPER_PORTAL.value}") # Build API endpoint URLs endpoint = f"{ApiConstants.BASEURL.value}/Search"