emailnator.config package¶
Submodules¶
emailnator.config.config module¶
Configuration settings for the EmailNator client.
This module provides functions to load configuration settings from a YAML file into a Config object. It includes settings for the API base URL, timeout, HTTP options, user agent, and Gmail-specific configuration.
- Typical Usage Example:
config = load_config() print(config.BASE_URL) ‘https://www.emailnator.com’
- class emailnator.config.config.Config¶
Bases:
objectConfiguration settings for the EmailNator client.
This class holds all constants and default settings required for interacting with the EmailNator API, including the base URL, timeout, HTTP options, user agent, and Gmail-specific configuration.
- BASE_URL¶
Base URL of the EmailNator API.
- Type:
str
- TIMEOUT¶
Default timeout for API requests, in seconds.
- Type:
int
- USE_HTTP2¶
Whether to use HTTP/2 for requests.
- Type:
bool
- USER_AGENT¶
Default User-Agent header for HTTP requests.
- Type:
str
- GMAIL_CONFIG¶
Default options for generating Gmail addresses.
- Type:
list
- PROXY¶
Proxy address (e.g., “http://127.0.0.1:8080”) or
- Type:
str | None
- - ``None`` if no proxy is used.
-
BASE_URL:
str¶
-
GMAIL_CONFIG:
list¶
-
PROXY:
str|None¶
-
TIMEOUT:
int¶
-
USER_AGENT:
str¶
-
USE_HTTP2:
bool¶
- set_proxy(proxy)¶
Set or remove the proxy configuration.
- Parameters:
proxy (str | None) – Proxy address to use for requests.
proxying. (- Use None to disable)
- Return type:
None
- emailnator.config.config.load_config(path=PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/emailnator-wrapper/envs/latest/lib/python3.13/site-packages/emailnator/config/config.yaml'))¶
Load configuration settings from a YAML file into a Config object.
Reads the YAML file at the given path and populates a Config instance with values for API base URL, timeout, HTTP options, user agent, and Gmail generation configuration. Default values are used if keys are missing.
- Parameters:
path (str | Path, optional) – Path to the YAML configuration file. Defaults to config.yaml in the same directory as this module.
- Returns:
- An instance of the Config class populated with settings
from the YAML file or default values.
- Return type:
emailnator.config.helpers module¶
Utility functions for Gmail configuration formatting.
This module provides helper functions for normalizing and formatting configuration values related to Gmail integration. It ensures that values are consistently represented as lists of strings, which is useful for downstream processing in account generation.
- Typical usage example:
from emailnator.config.helpers import format_gmail_config
config = format_gmail_config(”test@example.com”) print(config) # [”test@example.com”]
config = format_gmail_config([”a@gmail.com”, “b@gmail.com”]) print(config) # [”a@gmail.com”, “b@gmail.com”]
- emailnator.config.helpers.format_gmail_config(value)¶
Format a value into a list of Gmail configuration strings.
- Parameters:
value (Any) – Input value that can either be a list of strings or a single value convertible to a string.
- Returns:
A list containing the Gmail configuration strings.
- Return type:
List[str]