pihole-client
Python client for Pi-hole
Installation
pip install pihole-client
Examples
Create class
from pihole_client import PiholeClient
piholeClient = PiholeClient( "PIHOLE_DOMAIN", "PIHOLE_TOKEN" )
where:
- PIHOLE_DOMAIN: URL of Pi-hole WebUi page
- PIHOLE_TOKEN: Token of Pi-hole WebUi
or using environment variables "PIHOLE_DOMAIN" and "PIHOLE_TOKEN":
from dotenv import load_dotenv
import os
from pihole_client import PiholeClient
load_dotenv()
def main():
piholeClient = PiholeClient(
os.getenv('PIHOLE_DOMAIN'),
os.getenv('PIHOLE_TOKEN')
)
resp = piholeClient.get_custom_dns()
print(resp)
if __name__ == "__main__":
main()
Methods
# Checks for updates to the Pihole software
piholeClient.check_updates()
# Enables the Pihole filtering
piholeClient.enable()
# Disables the Pihole filtering
piholeClient.disable()
# Retrieves the domains in a specified list
piholeClient.get_list("regex_black")
# Retrieves custom DNS entries
piholeClient.get_custom_dns()
# Retrieves custom DNS entrie by domain
piholeClient.get_custom_dns_by_domain("home.homelab.lan")
# Add a custom DNS entry
piholeClient.add_custom_dns(domain="router.homelab.lan", ip_address="192.168.1.1")
# Delete a custom DNS entry
piholeClient.delete_custom_dns(domain="router.homelab.lan", ip_address="192.168.1.1")
# Retrieves custom CNAME entries
piholeClient.get_custom_cname()
# Add a custom CNAME entry
piholeClient.add_custom_cname(domain="router.homelab.lan", target="xiaomi.local")
# Delete a custom CNAME entry
piholeClient.delete_custom_cname(domain="router.homelab.lan", target="xiaomi.local")
Release files for pihole-client 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pihole_client-1.0.0.tar.gz | 3.9 kB | Details |
Release files / pihole_client-1.0.0.tar.gz
| Download URL | pihole_client-1.0.0.tar.gz |
|---|---|
| Size | 3.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
366c20f3a2e5020a6941e064421f7de8fe762de95c4b63c05c1de285ee58b519
|
|
BLAKE2b-256 checksum How to use checksums |
da38fbcc5aa8be22d5bddb4ab3962f5b897a9216609f1b14cd6ba8fecf034b79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|