pihole_lib package
Subpackages
- pihole_lib.models package
- Submodules
- pihole_lib.models.base module
- pihole_lib.models.client_mgmt module
- pihole_lib.models.dhcp module
- pihole_lib.models.dns module
- pihole_lib.models.domains module
- pihole_lib.models.ftl module
DatabaseUserDatabaseGroupDatabaseOwnerDatabaseInfoFTLDatabaseStatsFTLClientStatsFTLDnsmasqStatsFTLDnsmasqStats.dns_cache_insertedFTLDnsmasqStats.dns_cache_live_freedFTLDnsmasqStats.dns_queries_forwardedFTLDnsmasqStats.dns_auth_answeredFTLDnsmasqStats.dns_local_answeredFTLDnsmasqStats.dns_stale_answeredFTLDnsmasqStats.dns_unansweredFTLDnsmasqStats.dnssec_max_crypto_useFTLDnsmasqStats.dnssec_max_sig_failFTLDnsmasqStats.dnssec_max_workFTLDnsmasqStats.bootpFTLDnsmasqStats.pxeFTLDnsmasqStats.dhcp_ackFTLDnsmasqStats.dhcp_declineFTLDnsmasqStats.dhcp_discoverFTLDnsmasqStats.dhcp_informFTLDnsmasqStats.dhcp_nakFTLDnsmasqStats.dhcp_offerFTLDnsmasqStats.dhcp_releaseFTLDnsmasqStats.dhcp_requestFTLDnsmasqStats.noanswerFTLDnsmasqStats.leases_allocated_4FTLDnsmasqStats.leases_pruned_4FTLDnsmasqStats.leases_allocated_6FTLDnsmasqStats.leases_pruned_6FTLDnsmasqStats.tcp_connectionsFTLDnsmasqStats.dhcp_leasequeryFTLDnsmasqStats.dhcp_lease_unassignedFTLDnsmasqStats.dhcp_lease_actveFTLDnsmasqStats.dhcp_lease_unknownFTLDnsmasqStats.model_config
FTLStatsFTLInfo
- pihole_lib.models.groups module
- pihole_lib.models.host module
- pihole_lib.models.lists module
- pihole_lib.models.messages module
- pihole_lib.models.network module
NetworkDeviceAddressNetworkDeviceNetworkDevicesResponseNetworkGatewayNetworkGatewayResponseNetworkGatewayDetailedResponseNetworkInterfaceStatsNetworkInterfaceAddressNetworkInterfaceAddress.familyNetworkInterfaceAddress.scopeNetworkInterfaceAddress.flagsNetworkInterfaceAddress.prefixlenNetworkInterfaceAddress.addressNetworkInterfaceAddress.address_typeNetworkInterfaceAddress.localNetworkInterfaceAddress.local_typeNetworkInterfaceAddress.broadcastNetworkInterfaceAddress.broadcast_typeNetworkInterfaceAddress.labelNetworkInterfaceAddress.preferedNetworkInterfaceAddress.validNetworkInterfaceAddress.cstampNetworkInterfaceAddress.tstampNetworkInterfaceAddress.model_config
NetworkInterfaceNetworkInterface.nameNetworkInterface.speedNetworkInterface.typeNetworkInterface.flagsNetworkInterface.stateNetworkInterface.carrierNetworkInterface.proto_downNetworkInterface.addressNetworkInterface.broadcastNetworkInterface.perm_addressNetworkInterface.statsNetworkInterface.addressesNetworkInterface.model_config
NetworkInterfacesResponseNetworkRouteNetworkRoutesResponseNetworkDeviceDeleteResponse
- pihole_lib.models.padd module
PADDQueriesPADDCachePADDMemoryPADDSystemPADDNetworkBytesPADDNetworkInterfacePADDInterfacePADDVersionComponentPADDVersionRemotePADDVersionInfoPADDVersionDockerPADDVersionPADDConfigPADDSensorsPADDInfoPADDInfo.active_clientsPADDInfo.gravity_sizePADDInfo.top_domainPADDInfo.top_blockedPADDInfo.top_clientPADDInfo.recent_blockedPADDInfo.blockingPADDInfo.queriesPADDInfo.cachePADDInfo.systemPADDInfo.node_namePADDInfo.host_modelPADDInfo.ifacePADDInfo.versionPADDInfo.configPADDInfo.percent_memPADDInfo.percent_cpuPADDInfo.pidPADDInfo.sensorsPADDInfo.model_config
- pihole_lib.models.search module
- pihole_lib.models.session module
- pihole_lib.models.stats module
HistoryEntryHistoryResponseClientHistoryEntryClientHistoryResponseDatabaseHistoryResponseDatabaseClientHistoryResponseQueryEntryQueriesResponseQuerySuggestionsQuerySuggestionsResponseQueryTypesResponseDatabaseSummaryResponseTopClientTopClientsResponseTopDomainTopDomainsResponseUpstreamStatisticsUpstreamServerUpstreamsResponseRecentBlockedResponseSummaryQueriesSummaryClientsSummaryGravitySummaryResponse
- pihole_lib.models.system module
- pihole_lib.models.teleporter module
- pihole_lib.models.version module
- Module contents
Submodules
pihole_lib.actions module
Pi-hole Actions API client.
- class pihole_lib.actions.PiHoleActions(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Actions API client.
Handles action endpoints that perform operations on Pi-hole.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Update gravity database with streaming output for line in client.actions.update_gravity(): print(line.strip()) # Restart DNS service if client.actions.restart_dns(): print("DNS restarted successfully")
- update_gravity(color=False)[source]
Update Pi-hole’s gravity database (adlists).
Triggers Pi-hole’s gravity update process, which downloads and processes all configured adlists. The output is streamed with chunked encoding.
- restart_dns()[source]
Restart Pi-hole’s DNS service (pihole-FTL).
- Return type:
- Returns:
True if the restart was successful.
pihole_lib.backup module
Pi-hole Backup API client.
- class pihole_lib.backup.PiHoleBackup(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Backup API client.
Handles backup and restore operations using the Teleporter endpoint.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Export backup backup_file = client.backup.export_backup("/path/to/backups") print(f"Backup saved to: {backup_file}") # Import backup imported_files = client.backup.import_backup("/path/to/backup.zip") print(f"Imported {len(imported_files)} files")
- import_backup(file_path, import_options=None)[source]
Import Pi-hole settings from a backup file.
Note: This will overwrite your current configuration and restart Pi-hole.
- Parameters:
file_path (
str) – Full path to the backup ZIP file to import.import_options (
Optional[TeleporterImportOptions]) – Options specifying which elements to restore. If None, all items will be restored.
- Return type:
- Returns:
List of imported backup files/components.
pihole_lib.base module
Base classes for Pi-hole API clients.
pihole_lib.client module
Pi-hole API client.
- class pihole_lib.client.PiHoleClient(base_url, password, timeout=30, verify_ssl=True)[source]
Bases:
objectPi-hole API client.
Handles authentication and session management for Pi-hole API interactions. Can be used as a context manager for automatic cleanup.
Examples:
# Basic usage with property access with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get system information login_info = client.info.get_login_info() # Perform actions for line in client.actions.update_gravity(): print(line.strip()) # Manage lists all_lists = client.lists.get_lists() # Configuration management current_config = client.config.get_config() # Alternative usage with explicit class imports from pihole_lib import PiHoleInfo, PiHoleActions with PiHoleClient("http://192.168.1.100", password="secret") as client: info = PiHoleInfo(client) actions = PiHoleActions(client)
- DEFAULT_TIMEOUT = 30
- HEADER_SESSION_ID = 'X-FTL-SID'
- __exit__(exc_type, exc_val, exc_tb)[source]
Exit context manager and clean up resources.
- Return type:
- property info: PiHoleInfo
Get Pi-hole info API client.
- property actions: PiHoleActions
Get Pi-hole actions API client.
- property backup: PiHoleBackup
Get Pi-hole backup API client.
- property config: PiHoleConfig
Get Pi-hole config API client.
- property dhcp: PiHoleDHCP
Get Pi-hole DHCP API client.
- property lists: PiHoleLists
Get Pi-hole lists API client.
- property groups: PiHoleGroups
Get Pi-hole groups API client.
- property padd: PiHolePADD
Get Pi-hole PADD API client.
- property stats: PiHoleStats
Get Pi-hole stats API client.
- property domains: PiHoleDomains
Get Pi-hole domains API client.
- property network: PiHoleNetwork
Get Pi-hole network API client.
- property clients: PiHoleClients
Get Pi-hole clients API client.
pihole_lib.clients module
Pi-hole Clients API client.
- class pihole_lib.clients.PiHoleClients(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Clients API client.
Handles client management operations. Clients can be identified by IP address, MAC address, hostname, or interface.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get all clients all_clients = client.clients.get_clients() # Add a new client client.clients.add_client( client="192.168.1.50", comment="John's laptop", groups=[0, 1] ) # Get client suggestions suggestions = client.clients.get_client_suggestions()
- batch_delete_clients(items)[source]
Delete multiple clients from Pi-hole.
- Parameters:
items (
list[ClientBatchDeleteItem]) – List of ClientBatchDeleteItem objects.- Return type:
- Returns:
True if all clients were successfully deleted.
pihole_lib.config module
Pi-hole Config API client.
- class pihole_lib.config.PiHoleConfig(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Config API client.
Handles configuration endpoints for Pi-hole settings.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get current configuration config = client.config.get_config() print(f"DNS upstreams: {config['dns']['upstreams']}") # Update configuration client.config.update_config({"dns": {"upstreams": ["1.1.1.1"]}}) # Add/remove config items client.config.add_config_item("dns/upstreams", "8.8.8.8") client.config.remove_config_item("dns/upstreams", "8.8.8.8")
pihole_lib.dhcp module
Pi-hole DHCP management.
- class pihole_lib.dhcp.PiHoleDHCP(client)[source]
Bases:
BasePiHoleAPIClientPi-hole DHCP management client.
Provides methods to interact with Pi-hole’s DHCP functionality.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get active DHCP leases leases = client.dhcp.get_leases() for lease in leases.leases: print(f"{lease.name} ({lease.ip}) - {lease.hwaddr}") # Delete a lease client.dhcp.delete_lease("192.168.1.100")
pihole_lib.dns module
Pi-hole DNS management.
- class pihole_lib.dns.PiHoleDNS(client)[source]
Bases:
BasePiHoleAPIClientPi-hole DNS management client.
Provides methods to manage custom DNS records, retrieve DNS configuration, and control DNS blocking status.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get DNS configuration config = client.dns.get_config() print(f"Upstream servers: {config.upstreams}") # Manage DNS records client.dns.add_a_record("server.local", "192.168.1.100") client.dns.add_cname_record("www.local", "server.local") # Control blocking client.dns.disable_blocking(timer=300) # 5 minutes client.dns.enable_blocking()
- CONFIG_URL = '/api/config/dns'
- get_config()[source]
Get Pi-hole DNS configuration.
- Return type:
- Returns:
DNSConfig with upstream servers, custom records, and settings.
- get_records(record_type=None)[source]
Get all custom DNS records.
- Parameters:
record_type (
Optional[str]) – Filter by “A” or “CNAME”, or None for all records.- Return type:
- Returns:
List of DNSRecord objects.
- Raises:
ValueError – If an invalid record type is specified.
- get_blocking_status()[source]
Get DNS blocking status.
- Return type:
- Returns:
DNSBlockingStatus with current blocking state and timer info.
- set_blocking_status(blocking=True, timer=None)[source]
Change DNS blocking status.
- Parameters:
- Return type:
- Returns:
DNSBlockingStatus with updated state.
- enable_blocking(timer=None)[source]
Enable DNS blocking.
pihole_lib.domains module
Pi-hole domain management operations.
- class pihole_lib.domains.PiHoleDomains(client)[source]
Bases:
BasePiHoleAPIClientPi-hole domain management operations.
This class provides methods to manage domains on your Pi-hole instance, including adding, updating, deleting, and retrieving domains with various filtering options.
Examples:
from pihole_lib import PiHoleClient, DomainType, DomainKind with PiHoleClient("http://192.168.1.100", password="secret") as client: domains = client.domains # Get all domains all_domains = domains.get_domains() # Get only allowed domains allowed_domains = domains.get_domains(domain_type=DomainType.ALLOW) # Get specific domain domain = domains.get_domain("example.com", DomainType.ALLOW, DomainKind.EXACT) # Add a new domain result = domains.add_domain( domain="badsite.com", domain_type=DomainType.DENY, domain_kind=DomainKind.EXACT, comment="Blocked site", groups=[0], enabled=True ) # Update a domain updated = domains.update_domain( domain="example.com", domain_type=DomainType.ALLOW, domain_kind=DomainKind.EXACT, comment="Updated comment", enabled=False ) # Delete a domain domains.delete_domain("badsite.com", DomainType.DENY, DomainKind.EXACT) # Batch delete domains domains.batch_delete_domains([ DomainBatchDeleteItem( item="site1.com", type=DomainType.DENY, kind=DomainKind.EXACT ), DomainBatchDeleteItem( item="site2.com", type=DomainType.DENY, kind=DomainKind.EXACT ) ])
- get_domains(domain_type=None, domain_kind=None, domain=None)[source]
Get domains with optional filtering.
- Parameters:
domain_type (
Optional[DomainType]) – Filter by domain type (allow/deny).domain_kind (
Optional[DomainKind]) – Filter by domain kind (exact/regex).
- Return type:
- Returns:
List of Domain objects matching the filters.
- Raises:
PiHoleAPIError – API request failed.
PiHoleConnectionError – Connection failed.
PiHoleServerError – Server error.
Examples:
# Get all domains all_domains = domains.get_domains() # Get only allowed domains allowed = domains.get_domains(domain_type=DomainType.ALLOW) # Get only exact domains exact = domains.get_domains(domain_kind=DomainKind.EXACT) # Get specific domain across all types/kinds specific = domains.get_domains(domain="example.com") # Get allowed exact domains allowed_exact = domains.get_domains( domain_type=DomainType.ALLOW, domain_kind=DomainKind.EXACT )
- get_domain(domain, domain_type, domain_kind)[source]
Get a specific domain by exact match.
- Parameters:
domain (
str) – The domain name to retrieve.domain_type (
DomainType) – Type of domain (allow/deny).domain_kind (
DomainKind) – Kind of domain (exact/regex).
- Return type:
- Returns:
Domain object if found, None otherwise.
- Raises:
PiHoleAPIError – API request failed.
PiHoleConnectionError – Connection failed.
PiHoleServerError – Server error.
Examples:
# Get specific allowed exact domain domain = domains.get_domain( "example.com", DomainType.ALLOW, DomainKind.EXACT ) if domain: print(f"Found domain: {domain.domain}") else: print("Domain not found")
- add_domain(domain, domain_type, domain_kind, comment=None, groups=None, enabled=True)[source]
Add a new domain.
- Parameters:
domain (
str) – The domain name or regex pattern to add.domain_type (
DomainType) – Type of domain (allow/deny).domain_kind (
DomainKind) – Kind of domain (exact/regex).groups (
Optional[list[int]]) – List of group IDs. Defaults to [0] if not provided.enabled (
bool) – Whether the domain is enabled. Defaults to True.
- Return type:
- Returns:
DomainMutationResponse with the operation results.
- Raises:
PiHoleAPIError – API request failed or domain already exists.
PiHoleConnectionError – Connection failed.
PiHoleServerError – Server error.
Examples:
# Add an exact blocked domain result = domains.add_domain( domain="badsite.com", domain_type=DomainType.DENY, domain_kind=DomainKind.EXACT, comment="Malicious site", groups=[0, 1], enabled=True ) # Add a regex pattern result = domains.add_domain( domain=r".*\.ads\..*", domain_type=DomainType.DENY, domain_kind=DomainKind.REGEX, comment="Block ads subdomains" )
- update_domain(domain, domain_type, domain_kind, new_type=None, new_kind=None, comment=None, groups=None, enabled=None)[source]
Update an existing domain.
- Parameters:
domain (
str) – The domain name to update.domain_type (
DomainType) – Current type of domain (allow/deny).domain_kind (
DomainKind) – Current kind of domain (exact/regex).new_type (
Optional[DomainType]) – New type to move domain to (optional).new_kind (
Optional[DomainKind]) – New kind to move domain to (optional).
- Return type:
- Returns:
DomainMutationResponse with the operation results.
- Raises:
PiHoleAPIError – API request failed or domain not found.
PiHoleConnectionError – Connection failed.
PiHoleServerError – Server error.
Examples:
# Update domain comment and disable it result = domains.update_domain( domain="example.com", domain_type=DomainType.ALLOW, domain_kind=DomainKind.EXACT, comment="Updated comment", enabled=False ) # Move domain from allow to deny result = domains.update_domain( domain="example.com", domain_type=DomainType.ALLOW, domain_kind=DomainKind.EXACT, new_type=DomainType.DENY, new_kind=DomainKind.EXACT )
- delete_domain(domain, domain_type, domain_kind)[source]
Delete a domain.
- Parameters:
domain (
str) – The domain name to delete.domain_type (
DomainType) – Type of domain (allow/deny).domain_kind (
DomainKind) – Kind of domain (exact/regex).
- Raises:
PiHoleAPIError – API request failed or domain not found.
PiHoleConnectionError – Connection failed.
PiHoleServerError – Server error.
- Return type:
Examples:
# Delete an exact blocked domain domains.delete_domain( "badsite.com", DomainType.DENY, DomainKind.EXACT ) # Delete a regex pattern domains.delete_domain( r".*\.ads\..*", DomainType.DENY, DomainKind.REGEX )
- batch_delete_domains(domains)[source]
Delete multiple domains in a single request.
- Parameters:
domains (
list[DomainBatchDeleteItem]) – List of DomainBatchDeleteItem objects specifying domains to delete.- Return type:
- Returns:
True if successful.
- Raises:
PiHoleAPIError – API request failed.
PiHoleConnectionError – Connection failed.
PiHoleServerError – Server error.
Examples:
# Delete multiple domains success = domains.batch_delete_domains([ DomainBatchDeleteItem( item="site1.com", type=DomainType.DENY, kind=DomainKind.EXACT ), DomainBatchDeleteItem( item="site2.com", type=DomainType.DENY, kind=DomainKind.EXACT ), DomainBatchDeleteItem( item=r".*\.ads\..*", type=DomainType.DENY, kind=DomainKind.REGEX ) ]) print(f"Batch delete successful: {success}")
pihole_lib.exceptions module
Exceptions for Pi-hole API interactions.
- exception pihole_lib.exceptions.PiHoleAPIError(message, status_code=None)[source]
Bases:
ExceptionBase exception for Pi-hole API errors.
- message
Error description.
- status_code
HTTP status code if available.
- exception pihole_lib.exceptions.PiHoleConnectionError(message, status_code=None)[source]
Bases:
PiHoleAPIErrorConnection-related error.
- exception pihole_lib.exceptions.PiHoleAuthenticationError(message, status_code=None)[source]
Bases:
PiHoleAPIErrorAuthentication-related error.
- exception pihole_lib.exceptions.PiHoleServerError(message, status_code=None)[source]
Bases:
PiHoleAPIErrorServer-side error.
pihole_lib.groups module
Pi-hole Groups management.
- class pihole_lib.groups.PiHoleGroups(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Groups management client.
Provides methods to create, read, update, and delete groups.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get all groups all_groups = client.groups.get_groups() for group in all_groups: print(f"Group: {group.name}") # Create a new group client.groups.create_group(name="family_devices", comment="Family") # Delete a group client.groups.delete_group("family_devices")
pihole_lib.info module
Pi-hole Info API client.
- class pihole_lib.info.PiHoleInfo(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Info API client.
Handles information endpoints for system status and diagnostics.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get login info login_info = client.info.get_login_info() print(f"DNS running: {login_info.dns}") # Get system info system_info = client.info.get_system_info() print(f"Uptime: {system_info.system.uptime}s") # Get version info version = client.info.get_version_info() print(f"Pi-hole: {version.version.core.local.version}")
- get_login_info()[source]
Get login page related information.
- Return type:
- Returns:
LoginInfo with HTTPS port and DNS status.
- get_client_info()[source]
Get client request information.
- Return type:
- Returns:
ClientInfo with remote address, HTTP version, method, and headers.
- get_database_info()[source]
Get database information.
- Return type:
- Returns:
DatabaseInfo with file size, permissions, query counts, etc.
- get_ftl_info()[source]
Get FTL runtime information.
- Return type:
- Returns:
FTLInfo with database stats, process info, and resource usage.
- get_host_info()[source]
Get host system information.
- Return type:
- Returns:
HostInfo with uname details, hardware model, and DMI data.
- get_version_info()[source]
Get Pi-hole version information.
- Return type:
- Returns:
VersionInfo for all Pi-hole components.
- get_system_info()[source]
Get system resource information.
- Return type:
- Returns:
SystemInfo with uptime, memory, CPU, and FTL resource usage.
- get_messages()[source]
Get system messages.
- Return type:
- Returns:
MessagesInfo with diagnosis messages.
pihole_lib.lists module
Pi-hole Lists API client.
- class pihole_lib.lists.PiHoleLists(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Lists API client.
Handles domain list operations for blocklists and allowlists.
Examples:
from pihole_lib import PiHoleClient, ListType with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get all lists all_lists = client.lists.get_lists() # Add a blocklist client.lists.add_list( address="https://example.com/domains.txt", list_type=ListType.BLOCK, comment="Ad servers" ) # Search for domains results = client.lists.search_domains("example.com")
- add_list(address, list_type, comment=None, groups=None, enabled=True)[source]
Add a new domain list to Pi-hole.
- Parameters:
- Return type:
- Returns:
List of PiHoleList objects containing the created list.
- batch_delete_lists(items)[source]
Delete multiple domain lists from Pi-hole.
- Parameters:
items (
list[BatchDeleteItem]) – List of BatchDeleteItem objects specifying lists to delete.- Return type:
- Returns:
True if all lists were successfully deleted.
- update_list(address, list_type, comment=None, groups=None, enabled=True)[source]
Update an existing domain list in Pi-hole.
- Parameters:
- Return type:
- Returns:
ListsResponse with the updated list and processing results.
pihole_lib.network module
Pi-hole network API client.
- class pihole_lib.network.PiHoleNetwork(client)[source]
Bases:
BasePiHoleAPIClientPi-hole network API client.
Provides methods to gather network information as seen by Pi-hole.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get network devices devices = client.network.get_devices() for device in devices.devices: print(f"{device.name}: {device.hwaddr}") # Get gateway info gateway = client.network.get_gateway() # Get interfaces interfaces = client.network.get_interfaces()
- get_devices(max_devices=None, max_addresses=None)[source]
Get info about devices in your local network.
- Parameters:
- Return type:
- Returns:
NetworkDevicesResponse containing device information.
- get_gateway(detailed=False)[source]
Get info about the gateway.
- Parameters:
detailed (
bool) – If True, include detailed interface and route info.- Return type:
- Returns:
NetworkGatewayResponse or NetworkGatewayDetailedResponse.
- get_interfaces(detailed=False)[source]
Get info about network interfaces.
- Parameters:
detailed (
bool) – If True, include more detailed information.- Return type:
- Returns:
NetworkInterfacesResponse containing interface information.
- get_routes(detailed=False)[source]
Get info about network routes.
- Parameters:
detailed (
bool) – If True, include more detailed information.- Return type:
- Returns:
NetworkRoutesResponse containing route information.
pihole_lib.padd module
Pi-hole PADD (Pi-hole API Dashboard Data) management.
- class pihole_lib.padd.PiHolePADD(client)[source]
Bases:
BasePiHoleAPIClientPi-hole PADD (Pi-hole API Dashboard Data) client.
Provides comprehensive dashboard data including statistics, system information, network details, and configuration summaries.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: dashboard = client.padd.get_dashboard_data() print(f"Active clients: {dashboard.active_clients}") print(f"Total queries: {dashboard.queries.total}") print(f"Blocked: {dashboard.queries.blocked}")
pihole_lib.stats module
Pi-hole Stats API client.
- class pihole_lib.stats.PiHoleStats(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Stats API client.
Handles statistics and history endpoints for Pi-hole data analysis.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get activity history history = client.stats.get_history() # Get summary summary = client.stats.get_summary() print(f"Total queries: {summary.queries.total}") # Get top domains top_domains = client.stats.get_top_domains(count=10)
- get_history()[source]
Get activity graph data.
- Return type:
- Returns:
HistoryResponse with timestamps and query counts.
- get_client_history()[source]
Get per-client activity graph data.
- Return type:
- Returns:
ClientHistoryResponse with per-client activity data.
- get_database_history(from_timestamp, until_timestamp)[source]
Get activity graph data from long-term database.
- Parameters:
- Return type:
- Returns:
DatabaseHistoryResponse with long-term activity data.
- get_database_client_history(from_timestamp, until_timestamp)[source]
Get per-client activity data from long-term database.
- Parameters:
- Return type:
- Returns:
DatabaseClientHistoryResponse with long-term per-client data.
- get_queries(length=100, cursor=None, from_timestamp=None, until_timestamp=None, upstream=None, domain=None, client=None)[source]
Get query details with optional filtering.
- Parameters:
length (
int) – Number of queries to return (default: 100).from_timestamp (
Optional[int]) – Only show queries from this timestamp (optional).until_timestamp (
Optional[int]) – Only show queries until this timestamp (optional).upstream (
Optional[str]) – Filter by specific upstream (optional).domain (
Optional[str]) – Filter by specific domain (optional).client (
Optional[str]) – Filter by specific client (optional).
- Return type:
- Returns:
QueriesResponse with query details and pagination info.
- get_query_suggestions()[source]
Get query filter suggestions.
- Return type:
- Returns:
QuerySuggestionsResponse with available filter suggestions.
- get_query_types()[source]
Get query types statistics.
- Return type:
- Returns:
QueryTypesResponse with query types and counts.
- get_recent_blocked(count=10)[source]
Get most recently blocked domains.
- Parameters:
count (
int) – Number of blocked domains to return (default: 10).- Return type:
- Returns:
RecentBlockedResponse with recently blocked domains.
- get_summary()[source]
Get overview of Pi-hole activity.
- Return type:
- Returns:
SummaryResponse with comprehensive activity summary.
- get_top_clients(blocked=None, count=10)[source]
Get top clients by query count.
- Parameters:
- Return type:
- Returns:
TopClientsResponse with top clients and query counts.
- get_top_domains(blocked=None, count=10)[source]
Get top domains by query count.
- Parameters:
- Return type:
- Returns:
TopDomainsResponse with top domains and query counts.
- get_upstreams()[source]
Get metrics about upstream destinations.
- Return type:
- Returns:
UpstreamsResponse with upstream server metrics.
- get_database_query_types(from_timestamp, until_timestamp)[source]
Get query types from long-term database.
- Parameters:
- Return type:
- Returns:
QueryTypesResponse with query types for the time range.
- get_database_summary(from_timestamp, until_timestamp)[source]
Get database content details for a time range.
- Parameters:
- Return type:
- Returns:
DatabaseSummaryResponse with summary statistics.
- get_database_top_clients(from_timestamp, until_timestamp)[source]
Get top clients from long-term database.
- Parameters:
- Return type:
- Returns:
TopClientsResponse with top clients for the time range.
- get_database_top_domains(from_timestamp, until_timestamp)[source]
Get top domains from long-term database.
- Parameters:
- Return type:
- Returns:
TopDomainsResponse with top domains for the time range.
pihole_lib.utils module
Utility functions for Pi-hole API interactions.
- pihole_lib.utils.handle_pihole_response(response)[source]
Handle Pi-hole API response and raise appropriate exceptions.
- Parameters:
response (
Response) – The HTTP response from Pi-hole API.- Raises:
PiHoleAuthenticationError – Authentication failed or access denied.
PiHoleServerError – Server error (5xx status codes).
PiHoleAPIError – Other API errors (4xx status codes).
- Return type:
- pihole_lib.utils.make_pihole_request(client, method, endpoint, json=None, files=None, params=None, stream=False)[source]
Make a request to Pi-hole API with error handling.
- Parameters:
client (
PiHoleClient) – The PiHoleClient instance to use for the request.method (
str) – HTTP method (GET, POST, etc.).endpoint (
str) – The API endpoint path (e.g., “/api/info/login”).json (
Union[dict[str,Any],list[dict[str,Any]],None]) – Optional JSON data to send in the request body.files (
Optional[dict[str,Any]]) – Optional files to upload.params (
Optional[dict[str,Any]]) – Optional query parameters to include in the URL.stream (
bool) – Whether to stream the response. Defaults to False.
- Return type:
- Returns:
The HTTP response object.
- Raises:
PiHoleConnectionError – Connection failed.
PiHoleAuthenticationError – Authentication failed or access denied.
PiHoleServerError – Server error (5xx status codes).
PiHoleAPIError – Other API errors (4xx status codes).
- pihole_lib.utils.check_api_errors(response_data, item_name, operation='process')[source]
Check for API errors in the response and raise appropriate exceptions.
- Parameters:
- Raises:
PiHoleServerError – If Pi-hole reports an error.
- Return type:
Module contents
Pi-hole API Python Library.
A Python library for interacting with Pi-hole through its API. Handles authentication and session management.
- class pihole_lib.PiHoleClient(base_url, password, timeout=30, verify_ssl=True)[source]
Bases:
objectPi-hole API client.
Handles authentication and session management for Pi-hole API interactions. Can be used as a context manager for automatic cleanup.
Examples:
# Basic usage with property access with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get system information login_info = client.info.get_login_info() # Perform actions for line in client.actions.update_gravity(): print(line.strip()) # Manage lists all_lists = client.lists.get_lists() # Configuration management current_config = client.config.get_config() # Alternative usage with explicit class imports from pihole_lib import PiHoleInfo, PiHoleActions with PiHoleClient("http://192.168.1.100", password="secret") as client: info = PiHoleInfo(client) actions = PiHoleActions(client)
- DEFAULT_TIMEOUT = 30
- HEADER_SESSION_ID = 'X-FTL-SID'
- __exit__(exc_type, exc_val, exc_tb)[source]
Exit context manager and clean up resources.
- Return type:
- property info: PiHoleInfo
Get Pi-hole info API client.
- property actions: PiHoleActions
Get Pi-hole actions API client.
- property backup: PiHoleBackup
Get Pi-hole backup API client.
- property config: PiHoleConfig
Get Pi-hole config API client.
- property dhcp: PiHoleDHCP
Get Pi-hole DHCP API client.
- property lists: PiHoleLists
Get Pi-hole lists API client.
- property groups: PiHoleGroups
Get Pi-hole groups API client.
- property padd: PiHolePADD
Get Pi-hole PADD API client.
- property stats: PiHoleStats
Get Pi-hole stats API client.
- property domains: PiHoleDomains
Get Pi-hole domains API client.
- property network: PiHoleNetwork
Get Pi-hole network API client.
- property clients: PiHoleClients
Get Pi-hole clients API client.
- class pihole_lib.PiHoleInfo(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Info API client.
Handles information endpoints for system status and diagnostics.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get login info login_info = client.info.get_login_info() print(f"DNS running: {login_info.dns}") # Get system info system_info = client.info.get_system_info() print(f"Uptime: {system_info.system.uptime}s") # Get version info version = client.info.get_version_info() print(f"Pi-hole: {version.version.core.local.version}")
- get_login_info()[source]
Get login page related information.
- Return type:
- Returns:
LoginInfo with HTTPS port and DNS status.
- get_client_info()[source]
Get client request information.
- Return type:
- Returns:
ClientInfo with remote address, HTTP version, method, and headers.
- get_database_info()[source]
Get database information.
- Return type:
- Returns:
DatabaseInfo with file size, permissions, query counts, etc.
- get_ftl_info()[source]
Get FTL runtime information.
- Return type:
- Returns:
FTLInfo with database stats, process info, and resource usage.
- get_host_info()[source]
Get host system information.
- Return type:
- Returns:
HostInfo with uname details, hardware model, and DMI data.
- get_version_info()[source]
Get Pi-hole version information.
- Return type:
- Returns:
VersionInfo for all Pi-hole components.
- get_system_info()[source]
Get system resource information.
- Return type:
- Returns:
SystemInfo with uptime, memory, CPU, and FTL resource usage.
- get_messages()[source]
Get system messages.
- Return type:
- Returns:
MessagesInfo with diagnosis messages.
- class pihole_lib.PiHoleBackup(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Backup API client.
Handles backup and restore operations using the Teleporter endpoint.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Export backup backup_file = client.backup.export_backup("/path/to/backups") print(f"Backup saved to: {backup_file}") # Import backup imported_files = client.backup.import_backup("/path/to/backup.zip") print(f"Imported {len(imported_files)} files")
- import_backup(file_path, import_options=None)[source]
Import Pi-hole settings from a backup file.
Note: This will overwrite your current configuration and restart Pi-hole.
- Parameters:
file_path (
str) – Full path to the backup ZIP file to import.import_options (
Optional[TeleporterImportOptions]) – Options specifying which elements to restore. If None, all items will be restored.
- Return type:
- Returns:
List of imported backup files/components.
- class pihole_lib.PiHoleLists(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Lists API client.
Handles domain list operations for blocklists and allowlists.
Examples:
from pihole_lib import PiHoleClient, ListType with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get all lists all_lists = client.lists.get_lists() # Add a blocklist client.lists.add_list( address="https://example.com/domains.txt", list_type=ListType.BLOCK, comment="Ad servers" ) # Search for domains results = client.lists.search_domains("example.com")
- add_list(address, list_type, comment=None, groups=None, enabled=True)[source]
Add a new domain list to Pi-hole.
- Parameters:
- Return type:
- Returns:
List of PiHoleList objects containing the created list.
- batch_delete_lists(items)[source]
Delete multiple domain lists from Pi-hole.
- Parameters:
items (
list[BatchDeleteItem]) – List of BatchDeleteItem objects specifying lists to delete.- Return type:
- Returns:
True if all lists were successfully deleted.
- update_list(address, list_type, comment=None, groups=None, enabled=True)[source]
Update an existing domain list in Pi-hole.
- Parameters:
- Return type:
- Returns:
ListsResponse with the updated list and processing results.
- class pihole_lib.PiHoleActions(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Actions API client.
Handles action endpoints that perform operations on Pi-hole.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Update gravity database with streaming output for line in client.actions.update_gravity(): print(line.strip()) # Restart DNS service if client.actions.restart_dns(): print("DNS restarted successfully")
- update_gravity(color=False)[source]
Update Pi-hole’s gravity database (adlists).
Triggers Pi-hole’s gravity update process, which downloads and processes all configured adlists. The output is streamed with chunked encoding.
- restart_dns()[source]
Restart Pi-hole’s DNS service (pihole-FTL).
- Return type:
- Returns:
True if the restart was successful.
- class pihole_lib.PiHoleConfig(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Config API client.
Handles configuration endpoints for Pi-hole settings.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get current configuration config = client.config.get_config() print(f"DNS upstreams: {config['dns']['upstreams']}") # Update configuration client.config.update_config({"dns": {"upstreams": ["1.1.1.1"]}}) # Add/remove config items client.config.add_config_item("dns/upstreams", "8.8.8.8") client.config.remove_config_item("dns/upstreams", "8.8.8.8")
- class pihole_lib.PiHoleDHCP(client)[source]
Bases:
BasePiHoleAPIClientPi-hole DHCP management client.
Provides methods to interact with Pi-hole’s DHCP functionality.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get active DHCP leases leases = client.dhcp.get_leases() for lease in leases.leases: print(f"{lease.name} ({lease.ip}) - {lease.hwaddr}") # Delete a lease client.dhcp.delete_lease("192.168.1.100")
- class pihole_lib.PiHoleDNS(client)[source]
Bases:
BasePiHoleAPIClientPi-hole DNS management client.
Provides methods to manage custom DNS records, retrieve DNS configuration, and control DNS blocking status.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get DNS configuration config = client.dns.get_config() print(f"Upstream servers: {config.upstreams}") # Manage DNS records client.dns.add_a_record("server.local", "192.168.1.100") client.dns.add_cname_record("www.local", "server.local") # Control blocking client.dns.disable_blocking(timer=300) # 5 minutes client.dns.enable_blocking()
- CONFIG_URL = '/api/config/dns'
- get_config()[source]
Get Pi-hole DNS configuration.
- Return type:
- Returns:
DNSConfig with upstream servers, custom records, and settings.
- get_records(record_type=None)[source]
Get all custom DNS records.
- Parameters:
record_type (
Optional[str]) – Filter by “A” or “CNAME”, or None for all records.- Return type:
- Returns:
List of DNSRecord objects.
- Raises:
ValueError – If an invalid record type is specified.
- get_blocking_status()[source]
Get DNS blocking status.
- Return type:
- Returns:
DNSBlockingStatus with current blocking state and timer info.
- set_blocking_status(blocking=True, timer=None)[source]
Change DNS blocking status.
- Parameters:
- Return type:
- Returns:
DNSBlockingStatus with updated state.
- enable_blocking(timer=None)[source]
Enable DNS blocking.
- class pihole_lib.PiHoleDomains(client)[source]
Bases:
BasePiHoleAPIClientPi-hole domain management operations.
This class provides methods to manage domains on your Pi-hole instance, including adding, updating, deleting, and retrieving domains with various filtering options.
Examples:
from pihole_lib import PiHoleClient, DomainType, DomainKind with PiHoleClient("http://192.168.1.100", password="secret") as client: domains = client.domains # Get all domains all_domains = domains.get_domains() # Get only allowed domains allowed_domains = domains.get_domains(domain_type=DomainType.ALLOW) # Get specific domain domain = domains.get_domain("example.com", DomainType.ALLOW, DomainKind.EXACT) # Add a new domain result = domains.add_domain( domain="badsite.com", domain_type=DomainType.DENY, domain_kind=DomainKind.EXACT, comment="Blocked site", groups=[0], enabled=True ) # Update a domain updated = domains.update_domain( domain="example.com", domain_type=DomainType.ALLOW, domain_kind=DomainKind.EXACT, comment="Updated comment", enabled=False ) # Delete a domain domains.delete_domain("badsite.com", DomainType.DENY, DomainKind.EXACT) # Batch delete domains domains.batch_delete_domains([ DomainBatchDeleteItem( item="site1.com", type=DomainType.DENY, kind=DomainKind.EXACT ), DomainBatchDeleteItem( item="site2.com", type=DomainType.DENY, kind=DomainKind.EXACT ) ])
- get_domains(domain_type=None, domain_kind=None, domain=None)[source]
Get domains with optional filtering.
- Parameters:
domain_type (
Optional[DomainType]) – Filter by domain type (allow/deny).domain_kind (
Optional[DomainKind]) – Filter by domain kind (exact/regex).
- Return type:
- Returns:
List of Domain objects matching the filters.
- Raises:
PiHoleAPIError – API request failed.
PiHoleConnectionError – Connection failed.
PiHoleServerError – Server error.
Examples:
# Get all domains all_domains = domains.get_domains() # Get only allowed domains allowed = domains.get_domains(domain_type=DomainType.ALLOW) # Get only exact domains exact = domains.get_domains(domain_kind=DomainKind.EXACT) # Get specific domain across all types/kinds specific = domains.get_domains(domain="example.com") # Get allowed exact domains allowed_exact = domains.get_domains( domain_type=DomainType.ALLOW, domain_kind=DomainKind.EXACT )
- get_domain(domain, domain_type, domain_kind)[source]
Get a specific domain by exact match.
- Parameters:
domain (
str) – The domain name to retrieve.domain_type (
DomainType) – Type of domain (allow/deny).domain_kind (
DomainKind) – Kind of domain (exact/regex).
- Return type:
- Returns:
Domain object if found, None otherwise.
- Raises:
PiHoleAPIError – API request failed.
PiHoleConnectionError – Connection failed.
PiHoleServerError – Server error.
Examples:
# Get specific allowed exact domain domain = domains.get_domain( "example.com", DomainType.ALLOW, DomainKind.EXACT ) if domain: print(f"Found domain: {domain.domain}") else: print("Domain not found")
- add_domain(domain, domain_type, domain_kind, comment=None, groups=None, enabled=True)[source]
Add a new domain.
- Parameters:
domain (
str) – The domain name or regex pattern to add.domain_type (
DomainType) – Type of domain (allow/deny).domain_kind (
DomainKind) – Kind of domain (exact/regex).groups (
Optional[list[int]]) – List of group IDs. Defaults to [0] if not provided.enabled (
bool) – Whether the domain is enabled. Defaults to True.
- Return type:
- Returns:
DomainMutationResponse with the operation results.
- Raises:
PiHoleAPIError – API request failed or domain already exists.
PiHoleConnectionError – Connection failed.
PiHoleServerError – Server error.
Examples:
# Add an exact blocked domain result = domains.add_domain( domain="badsite.com", domain_type=DomainType.DENY, domain_kind=DomainKind.EXACT, comment="Malicious site", groups=[0, 1], enabled=True ) # Add a regex pattern result = domains.add_domain( domain=r".*\.ads\..*", domain_type=DomainType.DENY, domain_kind=DomainKind.REGEX, comment="Block ads subdomains" )
- update_domain(domain, domain_type, domain_kind, new_type=None, new_kind=None, comment=None, groups=None, enabled=None)[source]
Update an existing domain.
- Parameters:
domain (
str) – The domain name to update.domain_type (
DomainType) – Current type of domain (allow/deny).domain_kind (
DomainKind) – Current kind of domain (exact/regex).new_type (
Optional[DomainType]) – New type to move domain to (optional).new_kind (
Optional[DomainKind]) – New kind to move domain to (optional).
- Return type:
- Returns:
DomainMutationResponse with the operation results.
- Raises:
PiHoleAPIError – API request failed or domain not found.
PiHoleConnectionError – Connection failed.
PiHoleServerError – Server error.
Examples:
# Update domain comment and disable it result = domains.update_domain( domain="example.com", domain_type=DomainType.ALLOW, domain_kind=DomainKind.EXACT, comment="Updated comment", enabled=False ) # Move domain from allow to deny result = domains.update_domain( domain="example.com", domain_type=DomainType.ALLOW, domain_kind=DomainKind.EXACT, new_type=DomainType.DENY, new_kind=DomainKind.EXACT )
- delete_domain(domain, domain_type, domain_kind)[source]
Delete a domain.
- Parameters:
domain (
str) – The domain name to delete.domain_type (
DomainType) – Type of domain (allow/deny).domain_kind (
DomainKind) – Kind of domain (exact/regex).
- Raises:
PiHoleAPIError – API request failed or domain not found.
PiHoleConnectionError – Connection failed.
PiHoleServerError – Server error.
- Return type:
Examples:
# Delete an exact blocked domain domains.delete_domain( "badsite.com", DomainType.DENY, DomainKind.EXACT ) # Delete a regex pattern domains.delete_domain( r".*\.ads\..*", DomainType.DENY, DomainKind.REGEX )
- batch_delete_domains(domains)[source]
Delete multiple domains in a single request.
- Parameters:
domains (
list[DomainBatchDeleteItem]) – List of DomainBatchDeleteItem objects specifying domains to delete.- Return type:
- Returns:
True if successful.
- Raises:
PiHoleAPIError – API request failed.
PiHoleConnectionError – Connection failed.
PiHoleServerError – Server error.
Examples:
# Delete multiple domains success = domains.batch_delete_domains([ DomainBatchDeleteItem( item="site1.com", type=DomainType.DENY, kind=DomainKind.EXACT ), DomainBatchDeleteItem( item="site2.com", type=DomainType.DENY, kind=DomainKind.EXACT ), DomainBatchDeleteItem( item=r".*\.ads\..*", type=DomainType.DENY, kind=DomainKind.REGEX ) ]) print(f"Batch delete successful: {success}")
- class pihole_lib.PiHoleGroups(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Groups management client.
Provides methods to create, read, update, and delete groups.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get all groups all_groups = client.groups.get_groups() for group in all_groups: print(f"Group: {group.name}") # Create a new group client.groups.create_group(name="family_devices", comment="Family") # Delete a group client.groups.delete_group("family_devices")
- class pihole_lib.PiHoleNetwork(client)[source]
Bases:
BasePiHoleAPIClientPi-hole network API client.
Provides methods to gather network information as seen by Pi-hole.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get network devices devices = client.network.get_devices() for device in devices.devices: print(f"{device.name}: {device.hwaddr}") # Get gateway info gateway = client.network.get_gateway() # Get interfaces interfaces = client.network.get_interfaces()
- get_devices(max_devices=None, max_addresses=None)[source]
Get info about devices in your local network.
- Parameters:
- Return type:
- Returns:
NetworkDevicesResponse containing device information.
- get_gateway(detailed=False)[source]
Get info about the gateway.
- Parameters:
detailed (
bool) – If True, include detailed interface and route info.- Return type:
- Returns:
NetworkGatewayResponse or NetworkGatewayDetailedResponse.
- get_interfaces(detailed=False)[source]
Get info about network interfaces.
- Parameters:
detailed (
bool) – If True, include more detailed information.- Return type:
- Returns:
NetworkInterfacesResponse containing interface information.
- get_routes(detailed=False)[source]
Get info about network routes.
- Parameters:
detailed (
bool) – If True, include more detailed information.- Return type:
- Returns:
NetworkRoutesResponse containing route information.
- class pihole_lib.PiHolePADD(client)[source]
Bases:
BasePiHoleAPIClientPi-hole PADD (Pi-hole API Dashboard Data) client.
Provides comprehensive dashboard data including statistics, system information, network details, and configuration summaries.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: dashboard = client.padd.get_dashboard_data() print(f"Active clients: {dashboard.active_clients}") print(f"Total queries: {dashboard.queries.total}") print(f"Blocked: {dashboard.queries.blocked}")
- class pihole_lib.PiHoleStats(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Stats API client.
Handles statistics and history endpoints for Pi-hole data analysis.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get activity history history = client.stats.get_history() # Get summary summary = client.stats.get_summary() print(f"Total queries: {summary.queries.total}") # Get top domains top_domains = client.stats.get_top_domains(count=10)
- get_history()[source]
Get activity graph data.
- Return type:
- Returns:
HistoryResponse with timestamps and query counts.
- get_client_history()[source]
Get per-client activity graph data.
- Return type:
- Returns:
ClientHistoryResponse with per-client activity data.
- get_database_history(from_timestamp, until_timestamp)[source]
Get activity graph data from long-term database.
- Parameters:
- Return type:
- Returns:
DatabaseHistoryResponse with long-term activity data.
- get_database_client_history(from_timestamp, until_timestamp)[source]
Get per-client activity data from long-term database.
- Parameters:
- Return type:
- Returns:
DatabaseClientHistoryResponse with long-term per-client data.
- get_queries(length=100, cursor=None, from_timestamp=None, until_timestamp=None, upstream=None, domain=None, client=None)[source]
Get query details with optional filtering.
- Parameters:
length (
int) – Number of queries to return (default: 100).from_timestamp (
Optional[int]) – Only show queries from this timestamp (optional).until_timestamp (
Optional[int]) – Only show queries until this timestamp (optional).upstream (
Optional[str]) – Filter by specific upstream (optional).domain (
Optional[str]) – Filter by specific domain (optional).client (
Optional[str]) – Filter by specific client (optional).
- Return type:
- Returns:
QueriesResponse with query details and pagination info.
- get_query_suggestions()[source]
Get query filter suggestions.
- Return type:
- Returns:
QuerySuggestionsResponse with available filter suggestions.
- get_query_types()[source]
Get query types statistics.
- Return type:
- Returns:
QueryTypesResponse with query types and counts.
- get_recent_blocked(count=10)[source]
Get most recently blocked domains.
- Parameters:
count (
int) – Number of blocked domains to return (default: 10).- Return type:
- Returns:
RecentBlockedResponse with recently blocked domains.
- get_summary()[source]
Get overview of Pi-hole activity.
- Return type:
- Returns:
SummaryResponse with comprehensive activity summary.
- get_top_clients(blocked=None, count=10)[source]
Get top clients by query count.
- Parameters:
- Return type:
- Returns:
TopClientsResponse with top clients and query counts.
- get_top_domains(blocked=None, count=10)[source]
Get top domains by query count.
- Parameters:
- Return type:
- Returns:
TopDomainsResponse with top domains and query counts.
- get_upstreams()[source]
Get metrics about upstream destinations.
- Return type:
- Returns:
UpstreamsResponse with upstream server metrics.
- get_database_query_types(from_timestamp, until_timestamp)[source]
Get query types from long-term database.
- Parameters:
- Return type:
- Returns:
QueryTypesResponse with query types for the time range.
- get_database_summary(from_timestamp, until_timestamp)[source]
Get database content details for a time range.
- Parameters:
- Return type:
- Returns:
DatabaseSummaryResponse with summary statistics.
- get_database_top_clients(from_timestamp, until_timestamp)[source]
Get top clients from long-term database.
- Parameters:
- Return type:
- Returns:
TopClientsResponse with top clients for the time range.
- get_database_top_domains(from_timestamp, until_timestamp)[source]
Get top domains from long-term database.
- Parameters:
- Return type:
- Returns:
TopDomainsResponse with top domains for the time range.
- class pihole_lib.PiHoleClients(client)[source]
Bases:
BasePiHoleAPIClientPi-hole Clients API client.
Handles client management operations. Clients can be identified by IP address, MAC address, hostname, or interface.
Examples:
from pihole_lib import PiHoleClient with PiHoleClient("http://192.168.1.100", password="secret") as client: # Get all clients all_clients = client.clients.get_clients() # Add a new client client.clients.add_client( client="192.168.1.50", comment="John's laptop", groups=[0, 1] ) # Get client suggestions suggestions = client.clients.get_client_suggestions()
- batch_delete_clients(items)[source]
Delete multiple clients from Pi-hole.
- Parameters:
items (
list[ClientBatchDeleteItem]) – List of ClientBatchDeleteItem objects.- Return type:
- Returns:
True if all clients were successfully deleted.
- class pihole_lib.BasePiHoleAPIClient(client)[source]
Bases:
objectBase class for Pi-hole API clients.
Provides common functionality for all API client classes.
- __init__(client)[source]
Initialize the API client.
- Parameters:
client (
PiHoleClient) – PiHoleClient instance to use for requests.
- exception pihole_lib.PiHoleAPIError(message, status_code=None)[source]
Bases:
ExceptionBase exception for Pi-hole API errors.
- message
Error description.
- status_code
HTTP status code if available.
- exception pihole_lib.PiHoleAuthenticationError(message, status_code=None)[source]
Bases:
PiHoleAPIErrorAuthentication-related error.
- exception pihole_lib.PiHoleConnectionError(message, status_code=None)[source]
Bases:
PiHoleAPIErrorConnection-related error.
- exception pihole_lib.PiHoleServerError(message, status_code=None)[source]
Bases:
PiHoleAPIErrorServer-side error.
- class pihole_lib.ProcessedSuccess(**data)[source]
Bases:
StrictModelGeneric success item in processing result.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.ProcessedError(**data)[source]
Bases:
StrictModelGeneric error item in processing result.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.ProcessedResult(**data)[source]
Bases:
StrictModelGeneric processing result.
-
success:
list[ProcessedSuccess]
-
errors:
list[ProcessedError]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
success:
- class pihole_lib.ListType(value)[source]
-
Pi-hole list types.
- ALLOW = 'allow'
- BLOCK = 'block'
- __format__(format_spec)
Returns format using actual value type unless __str__ has been overridden.
- class pihole_lib.DomainType(value)[source]
-
Pi-hole domain types.
- ALLOW = 'allow'
- DENY = 'deny'
- __format__(format_spec)
Returns format using actual value type unless __str__ has been overridden.
- class pihole_lib.DomainKind(value)[source]
-
Pi-hole domain kinds.
- EXACT = 'exact'
- REGEX = 'regex'
- __format__(format_spec)
Returns format using actual value type unless __str__ has been overridden.
- class pihole_lib.RAMStats(**data)[source]
Bases:
MemoryStatsRAM statistics with available memory.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.MemoryStats(**data)[source]
Bases:
StrictModelMemory statistics (RAM or Swap).
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.Memory(**data)[source]
Bases:
StrictModelCombined RAM and swap memory information.
-
swap:
MemoryStats
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
swap:
- class pihole_lib.CPULoad(**data)[source]
Bases:
StrictModelCPU load averages.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.CPUStats(**data)[source]
Bases:
StrictModelCPU statistics.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.FTLResourceUsage(**data)[source]
Bases:
StrictModelFTL process resource usage.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.SystemDetails(**data)[source]
Bases:
StrictModelSystem resource details.
-
ftl:
FTLResourceUsage
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
ftl:
- class pihole_lib.SystemInfo(**data)[source]
Bases:
StrictModelPi-hole system information wrapper.
-
system:
SystemDetails
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
system:
- class pihole_lib.VersionLocal(**data)[source]
Bases:
StrictModelLocal version information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.VersionRemote(**data)[source]
Bases:
StrictModelRemote version information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.ComponentVersion(**data)[source]
Bases:
StrictModelComponent version information.
-
local:
VersionLocal
-
remote:
VersionRemote
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
local:
- class pihole_lib.DockerVersion(**data)[source]
Bases:
StrictModelDocker version information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.VersionDetails(**data)[source]
Bases:
StrictModelPi-hole version details for all components.
-
core:
ComponentVersion
-
web:
ComponentVersion
-
ftl:
ComponentVersion
-
docker:
DockerVersion
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
core:
- class pihole_lib.VersionInfo(**data)[source]
Bases:
TimedResponsePi-hole version information response.
-
version:
VersionDetails
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
version:
- class pihole_lib.LoginInfo(**data)[source]
Bases:
StrictModelPi-hole login page information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.PiHoleAuthSession(**data)[source]
Bases:
StrictModelPi-hole authentication session data.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.ClientHeader(**data)[source]
Bases:
StrictModelHTTP header from client request.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.ClientInfo(**data)[source]
Bases:
StrictModelPi-hole client request information.
-
headers:
list[ClientHeader]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
headers:
- class pihole_lib.DatabaseUser(**data)[source]
Bases:
StrictModelDatabase file user information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.DatabaseGroup(**data)[source]
Bases:
StrictModelDatabase file group information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.DatabaseOwner(**data)[source]
Bases:
StrictModelDatabase file ownership information.
-
user:
DatabaseUser
-
group:
DatabaseGroup
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
user:
- class pihole_lib.DatabaseInfo(**data)[source]
Bases:
StrictModelPi-hole database information.
-
owner:
DatabaseOwner
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
owner:
- class pihole_lib.FTLDatabaseStats(**data)[source]
Bases:
StrictModelFTL database statistics.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.FTLClientStats(**data)[source]
Bases:
StrictModelFTL client statistics.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.FTLDnsmasqStats(**data)[source]
Bases:
StrictModelFTL dnsmasq statistics.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.FTLStats(**data)[source]
Bases:
StrictModelFTL statistics.
-
database:
FTLDatabaseStats
-
clients:
FTLClientStats
-
dnsmasq:
FTLDnsmasqStats
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
database:
- class pihole_lib.FTLInfo(**data)[source]
Bases:
StrictModelPi-hole FTL information wrapper.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.HostUname(**data)[source]
Bases:
StrictModelHost system uname information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.HostDMIBios(**data)[source]
Bases:
StrictModelHost DMI BIOS information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.HostDMIBoard(**data)[source]
Bases:
StrictModelHost DMI board information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.HostDMIProduct(**data)[source]
Bases:
StrictModelHost DMI product information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.HostDMISystem(**data)[source]
Bases:
StrictModelHost DMI system information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.HostDMI(**data)[source]
Bases:
StrictModelHost DMI/SMBIOS information.
-
bios:
HostDMIBios
-
board:
HostDMIBoard
-
product:
HostDMIProduct
-
sys:
HostDMISystem
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
bios:
- class pihole_lib.HostDetails(**data)[source]
Bases:
StrictModelHost system details.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.HostInfo(**data)[source]
Bases:
StrictModelPi-hole host system information wrapper.
-
host:
HostDetails
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
host:
- class pihole_lib.PiHoleList(**data)[source]
Bases:
StrictModelPi-hole domain list.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.AddListRequest(**data)[source]
Bases:
StrictModelRequest model for adding a new Pi-hole list.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.UpdateListRequest(**data)[source]
Bases:
StrictModelRequest model for updating an existing Pi-hole list.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.BatchDeleteItem(**data)[source]
Bases:
StrictModelItem for batch delete operation.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.ListProcessedSuccess(**data)[source]
Bases:
StrictModelSuccess item in list processing result.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.ListProcessedError(**data)[source]
Bases:
StrictModelError item in list processing result.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.ListProcessedResult(**data)[source]
Bases:
StrictModelProcessing result for list operations.
-
success:
list[ListProcessedSuccess]
-
errors:
list[ListProcessedError]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
success:
- class pihole_lib.ListsResponse(**data)[source]
Bases:
TimedResponseResponse model for list operations.
-
lists:
list[PiHoleList]
-
processed:
ListProcessedResult|None
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
lists:
- class pihole_lib.SearchResultCounts(**data)[source]
Bases:
StrictModelSearch result counts.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.SearchGravityCounts(**data)[source]
Bases:
StrictModelSearch gravity result counts.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.SearchResults(**data)[source]
Bases:
StrictModelSearch results summary.
-
domains:
SearchResultCounts
-
gravity:
SearchGravityCounts
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
domains:
- class pihole_lib.SearchParameters(**data)[source]
Bases:
StrictModelSearch parameters used.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.SearchData(**data)[source]
Bases:
StrictModelSearch data container.
-
domains:
list[PiHoleList]
-
gravity:
list[PiHoleList]
-
results:
SearchResults
-
parameters:
SearchParameters
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
domains:
- class pihole_lib.SearchResponse(**data)[source]
Bases:
TimedResponseResponse for domain search operations.
-
search:
SearchData
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
search:
- class pihole_lib.Message(**data)[source]
Bases:
StrictModelPi-hole system message.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.MessagesInfo(**data)[source]
Bases:
StrictModelPi-hole messages information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.MessagesCountInfo(**data)[source]
Bases:
StrictModelPi-hole messages count information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.DHCPLease(**data)[source]
Bases:
StrictModelDHCP lease information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.DHCPLeasesInfo(**data)[source]
Bases:
StrictModelDHCP leases information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.PADDQueries(**data)[source]
Bases:
StrictModelPADD queries information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.PADDCache(**data)[source]
Bases:
StrictModelPADD cache information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.PADDMemory(**data)[source]
Bases:
StrictModelPADD memory information.
-
swap:
MemoryStats
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
swap:
- class pihole_lib.PADDSystem(**data)[source]
Bases:
StrictModelPADD system information.
-
memory:
PADDMemory
-
ftl:
FTLResourceUsage
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
memory:
- class pihole_lib.NetworkBytes(**data)[source]
Bases:
StrictModelNetwork byte count with unit.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.PADDNetworkBytes(**data)[source]
Bases:
StrictModelPADD network bytes information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.PADDNetworkInterface(**data)[source]
Bases:
StrictModelPADD network interface information.
-
rx_bytes:
PADDNetworkBytes|None
-
tx_bytes:
PADDNetworkBytes|None
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
rx_bytes:
- class pihole_lib.PADDInterface(**data)[source]
Bases:
StrictModelPADD interface information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.PADDVersionComponent(**data)[source]
Bases:
StrictModelPADD version component information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.PADDVersionRemote(**data)[source]
Bases:
StrictModelPADD remote version information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.PADDVersionInfo(**data)[source]
Bases:
StrictModelPADD version component info.
-
local:
PADDVersionComponent
-
remote:
PADDVersionRemote
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
local:
- class pihole_lib.PADDVersionDocker(**data)[source]
Bases:
StrictModelPADD Docker version information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.PADDVersion(**data)[source]
Bases:
StrictModelPADD version information.
-
core:
PADDVersionInfo
-
web:
PADDVersionInfo
-
ftl:
PADDVersionInfo
-
docker:
PADDVersionDocker
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
core:
- class pihole_lib.PADDConfig(**data)[source]
Bases:
StrictModelPADD configuration information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.PADDSensors(**data)[source]
Bases:
StrictModelPADD sensors information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.PADDInfo(**data)[source]
Bases:
StrictModelPi-hole PADD (Pi-hole API Dashboard Data) information.
-
queries:
PADDQueries
-
system:
PADDSystem
-
iface:
PADDInterface
-
version:
PADDVersion
-
config:
PADDConfig
-
sensors:
PADDSensors
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
queries:
- class pihole_lib.DNSRecord(**data)[source]
Bases:
StrictModelDNS record information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.DNSConfig(**data)[source]
Bases:
StrictModelDNS configuration information.
- classmethod from_raw_config(raw_config)[source]
Create DNSConfig from raw API response.
- Return type:
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.DNSConfigInfo(**data)[source]
Bases:
StrictModelDNS configuration response information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.DNSBlockingStatus(**data)[source]
Bases:
TimedResponseDNS blocking status information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.Group(**data)[source]
Bases:
StrictModelPi-hole group information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.GroupRequest(**data)[source]
Bases:
StrictModelRequest model for creating or updating a group.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.GroupProcessedSuccess(**data)[source]
Bases:
StrictModelSuccess item in group processing result.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.GroupProcessedError(**data)[source]
Bases:
StrictModelError item in group processing result.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.GroupProcessedResult(**data)[source]
Bases:
StrictModelProcessing result for group operations.
-
success:
list[GroupProcessedSuccess]
-
errors:
list[GroupProcessedError]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
success:
- class pihole_lib.GroupsResponse(**data)[source]
Bases:
TimedResponseResponse model for group operations.
-
processed:
GroupProcessedResult|None
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
processed:
- class pihole_lib.HistoryEntry(**data)[source]
Bases:
StrictModelHistory entry for activity graph data.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.HistoryResponse(**data)[source]
Bases:
TimedResponseResponse for history endpoints.
-
history:
list[HistoryEntry]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
history:
- class pihole_lib.ClientHistoryEntry(**data)[source]
Bases:
StrictModelClient history entry for per-client activity data.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.ClientHistoryResponse(**data)[source]
Bases:
TimedResponseResponse for client history endpoints.
-
history:
list[ClientHistoryEntry]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
history:
- class pihole_lib.DatabaseHistoryResponse(**data)[source]
Bases:
TimedResponseResponse for database history endpoints.
-
history:
list[HistoryEntry]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
history:
- class pihole_lib.DatabaseClientHistoryResponse(**data)[source]
Bases:
TimedResponseResponse for database client history endpoints.
-
history:
list[ClientHistoryEntry]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
history:
- class pihole_lib.QueryEntry(**data)[source]
Bases:
StrictModelIndividual query entry.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.QueriesResponse(**data)[source]
Bases:
TimedResponseResponse for queries endpoint.
-
queries:
list[QueryEntry]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
queries:
- class pihole_lib.QuerySuggestions(**data)[source]
Bases:
StrictModelQuery filter suggestions.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.QuerySuggestionsResponse(**data)[source]
Bases:
TimedResponseResponse for query suggestions endpoint.
-
suggestions:
QuerySuggestions
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
suggestions:
- class pihole_lib.QueryTypesResponse(**data)[source]
Bases:
TimedResponseResponse for query types endpoints.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.DatabaseSummaryResponse(**data)[source]
Bases:
TimedResponseResponse for database summary endpoint.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.TopClient(**data)[source]
Bases:
StrictModelTop client entry.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.TopClientsResponse(**data)[source]
Bases:
TimedResponseResponse for top clients endpoints.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.TopDomain(**data)[source]
Bases:
StrictModelTop domain entry.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.TopDomainsResponse(**data)[source]
Bases:
TimedResponseResponse for top domains endpoints.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.UpstreamStatistics(**data)[source]
Bases:
StrictModelUpstream server statistics.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.UpstreamServer(**data)[source]
Bases:
StrictModelUpstream server information.
-
statistics:
UpstreamStatistics|None
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
statistics:
- class pihole_lib.UpstreamsResponse(**data)[source]
Bases:
TimedResponseResponse for upstreams endpoints.
-
upstreams:
list[UpstreamServer]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
upstreams:
- class pihole_lib.RecentBlockedResponse(**data)[source]
Bases:
TimedResponseResponse for recent blocked domains endpoint.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.SummaryQueries(**data)[source]
Bases:
StrictModelSummary queries information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.SummaryClients(**data)[source]
Bases:
StrictModelSummary clients information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.SummaryGravity(**data)[source]
Bases:
StrictModelSummary gravity information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.SummaryResponse(**data)[source]
Bases:
TimedResponseResponse for summary endpoint.
-
queries:
SummaryQueries
-
clients:
SummaryClients
-
gravity:
SummaryGravity
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
queries:
- class pihole_lib.Domain(**data)[source]
Bases:
StrictModelPi-hole domain entry.
-
type:
DomainType
-
kind:
DomainKind
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
type:
- class pihole_lib.DomainsResponse(**data)[source]
Bases:
TimedResponseResponse for domains endpoints.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.DomainRequest(**data)[source]
Bases:
StrictModelRequest for adding/updating domains.
-
type:
DomainType|None
-
kind:
DomainKind|None
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
type:
- class pihole_lib.DomainBatchDeleteItem(**data)[source]
Bases:
StrictModelItem for batch domain deletion.
-
type:
DomainType
-
kind:
DomainKind
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
type:
- class pihole_lib.DomainProcessedSuccess(**data)[source]
Bases:
StrictModelSuccessful domain processing result.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.DomainProcessedError(**data)[source]
Bases:
StrictModelFailed domain processing result.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.DomainProcessedResult(**data)[source]
Bases:
StrictModelDomain processing results.
-
success:
list[DomainProcessedSuccess]
-
errors:
list[DomainProcessedError]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
success:
- class pihole_lib.DomainMutationResponse(**data)[source]
Bases:
TimedResponseResponse for domain mutation operations.
-
processed:
DomainProcessedResult
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
processed:
- class pihole_lib.DomainBatchDeleteResponse(**data)[source]
Bases:
TimedResponseResponse for batch domain deletion.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.NetworkDeviceAddress(**data)[source]
Bases:
StrictModelNetwork device address information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.NetworkDevice(**data)[source]
Bases:
StrictModelNetwork device information.
-
addresses:
list[NetworkDeviceAddress]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
addresses:
- class pihole_lib.NetworkDevicesResponse(**data)[source]
Bases:
TimedResponseResponse for network devices endpoint.
-
devices:
list[NetworkDevice]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
devices:
- class pihole_lib.NetworkGateway(**data)[source]
Bases:
StrictModelNetwork gateway information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.NetworkGatewayResponse(**data)[source]
Bases:
TimedResponseResponse for network gateway endpoint.
-
gateway:
list[NetworkGateway]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
gateway:
- class pihole_lib.NetworkGatewayDetailedResponse(**data)[source]
Bases:
TimedResponseResponse for detailed network gateway endpoint.
-
gateway:
list[NetworkGateway]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
gateway:
- class pihole_lib.NetworkInterfaceStats(**data)[source]
Bases:
StrictModelNetwork interface statistics.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.NetworkInterfaceAddress(**data)[source]
Bases:
StrictModelNetwork interface address information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.NetworkInterface(**data)[source]
Bases:
StrictModelNetwork interface information.
-
stats:
NetworkInterfaceStats
-
addresses:
list[NetworkInterfaceAddress] |None
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
stats:
- class pihole_lib.NetworkInterfacesResponse(**data)[source]
Bases:
TimedResponseResponse for network interfaces endpoint.
-
interfaces:
list[NetworkInterface]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
interfaces:
- class pihole_lib.NetworkRoute(**data)[source]
Bases:
StrictModelNetwork route information.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.NetworkRoutesResponse(**data)[source]
Bases:
TimedResponseResponse for network routes endpoint.
-
routes:
list[NetworkRoute]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
routes:
- class pihole_lib.NetworkDeviceDeleteResponse(**data)[source]
Bases:
TimedResponseResponse for network device deletion.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.Client(**data)[source]
Bases:
StrictModelPi-hole client entry.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.ClientRequest(**data)[source]
Bases:
StrictModelRequest model for creating or updating a client.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.ClientUpdateRequest(**data)[source]
Bases:
StrictModelRequest model for updating an existing client.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.ClientBatchDeleteItem(**data)[source]
Bases:
StrictModelItem for batch client deletion.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.ClientProcessedSuccess(**data)[source]
Bases:
StrictModelSuccess item in client processing result.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.ClientProcessedError(**data)[source]
Bases:
StrictModelError item in client processing result.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.ClientProcessedResult(**data)[source]
Bases:
StrictModelProcessing result for client operations.
-
success:
list[ClientProcessedSuccess]
-
errors:
list[ClientProcessedError]
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
success:
- class pihole_lib.ClientsResponse(**data)[source]
Bases:
TimedResponseResponse model for client operations.
-
processed:
ClientProcessedResult|None
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
processed:
- class pihole_lib.ClientSuggestionsResponse(**data)[source]
Bases:
TimedResponseResponse model for client suggestions.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.TeleporterGravityOptions(**data)[source]
Bases:
StrictModelTeleporter gravity database import options.
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class pihole_lib.TeleporterImportOptions(**data)[source]
Bases:
StrictModelPi-hole Teleporter import options.
-
gravity:
TeleporterGravityOptions
- model_config: ClassVar[ConfigDict] = {'populate_by_name': True, 'validate_by_alias': True, 'validate_by_name': True}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
-
gravity: