{"id":27720687,"url":"https://github.com/the-last-cookie/pyhole","last_synced_at":"2026-05-15T03:35:21.342Z","repository":{"id":289258579,"uuid":"970119068","full_name":"The-Last-Cookie/pyhole","owner":"The-Last-Cookie","description":"Python library for the Pi-hole 6.0 REST API","archived":false,"fork":false,"pushed_at":"2025-04-25T23:12:42.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-27T09:59:52.213Z","etag":null,"topics":["api","api-rest","library","pi-hole","pihole","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/The-Last-Cookie.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-21T14:00:17.000Z","updated_at":"2025-04-25T23:12:46.000Z","dependencies_parsed_at":"2025-04-22T11:47:42.805Z","dependency_job_id":null,"html_url":"https://github.com/The-Last-Cookie/pyhole","commit_stats":null,"previous_names":["the-last-cookie/pyhole"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/The-Last-Cookie%2Fpyhole","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/The-Last-Cookie%2Fpyhole/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/The-Last-Cookie%2Fpyhole/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/The-Last-Cookie%2Fpyhole/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/The-Last-Cookie","download_url":"https://codeload.github.com/The-Last-Cookie/pyhole/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251119576,"owners_count":21539194,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-rest","library","pi-hole","pihole","python"],"created_at":"2025-04-27T09:59:58.566Z","updated_at":"2026-05-15T03:35:21.333Z","avatar_url":"https://github.com/The-Last-Cookie.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pyhole\n\n![badge](https://badgen.net/badge/ftl/v6.3.3/blue)\n![badge](https://badgen.net/badge/python/v3.13/blue?icon=pypi)\n\nPython library for accessing the Pihole 6 REST API.\n\nThis project is **not affiliated** with [Pi-hole](https://github.com/pi-hole).\n\n*Note: This is still in active development, so stuff may break!*\n\n## Installation\n\n### Import\n\nDownload the `pyhole.py` file and then import it in Python like so:\n\n```py\nfrom pyhole import Pihole\n```\n\n### Secure requests\n\n*Notice: This step is required for the script to work!*\n\nIt is recommended that you use SSL for your requests to the API. Newer versions of the `request` module require the `KeyUsage` and `ExtendedKeyUsage` parameters to be set. By default, Pi-hole creates a certificate without these parameters. In any case, copy the root CA certificate without the private key (**not** the server certificate!) (by default `/etc/pihole/tls_ca.crt`) to the device where the script is executed (e.g. `/home/user/pi_certificate.pem`). After that, set the `CERT_BUNDLE` variable e.g. in the `config.json` to the path where you stored the certificate.\n\nIf you don't want to use SSL, set the `CERT_BUNDLE` variable to `0` (integer). Keep in mind though that the requests made to the API will be unencrypted in this case and warnings will be displayed on the console.\n\n## Example code\n\n```py\nfrom pyhole import Pihole\n\n# get data from config.json\ncert = \"/path/to/cert.pem or crt\"\npassword = \"your_password\"\n\npi = Pihole(\"https://pi.hole/api\", cert)\npi.authenticate(password)\n\nhistory = pi.metrics.get_history()\ndevices = pi.network.get_devices()\ngateway = pi.network.get_gateway()\n```\n\n## References\n\n- Inspiration for the class structure taken from [How to \"namespace\" methods in Python class](https://stackoverflow.com/questions/48406389/how-to-namespace-methods-in-python-class).\n- [Designing Pythonic library APIs](https://benhoyt.com/writings/python-api-design/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-last-cookie%2Fpyhole","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthe-last-cookie%2Fpyhole","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthe-last-cookie%2Fpyhole/lists"}