payments-py

module utils

Utility functions for the payments library.


function snake_to_camel

snake_to_camel(name)

Convert snake_case to camelCase.

:param name: str :return: str


function is_ethereum_address

is_ethereum_address(address: str)  bool

Check if a string is a valid Ethereum address.

Args:

Returns: True if the address is valid, False otherwise


function get_random_big_int

get_random_big_int(bits: int = 128)  int

Generate a random big integer with the specified number of bits.

Args:

Returns: A random big integer


function generate_step_id

generate_step_id()  str

Generate a random step id.

:return: str


function is_step_id_valid

is_step_id_valid(step_id: str)  bool

Check if the step id has the right format.

:param step_id: str :return: bool


function sleep

sleep(ms: int)  None

Sleep for the specified number of milliseconds.

Args:


function json_replacer

json_replacer(key: str, value: Any)  Any

Custom JSON replacer function to handle special values.

Args:

Returns: The value to serialize, or None to exclude the key-value pair


function decode_access_token

decode_access_token(access_token: str)  Optional[Dict[str, Any]]

Decode an access token to extract wallet address and plan ID.

Args:

Returns: The decoded token data or None if invalid


function get_query_protocol_endpoints

get_query_protocol_endpoints(server_host: str)

Returns the list of endpoints that are used by agents/services implementing the Nevermined Query Protocol.

:param server_host: str :return: list


function get_ai_hub_open_api_url

get_ai_hub_open_api_url(server_host: str)  str

Returns the URL to the OpenAPI documentation of the AI Hub.

:param server_host: str :return: str


function get_service_host_from_endpoints

get_service_host_from_endpoints(endpoints: List[Dict[str, str]])  Optional[str]

Extract the service host from a list of endpoints.

Args:

Returns: The service host URL or None if not found


This file was automatically generated via lazydocs.