{"id":22184196,"url":"https://github.com/XelK/pi_hole_api","last_synced_at":"2025-07-26T19:31:09.575Z","repository":{"id":57452655,"uuid":"422878766","full_name":"XelK/pi_hole_api","owner":"XelK","description":"Pi-hole python api","archived":false,"fork":false,"pushed_at":"2025-02-11T09:52:27.000Z","size":47,"stargazers_count":7,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-18T22:02:24.446Z","etag":null,"topics":["api-wrapper","codereview","pihole","pip","python3","requests"],"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/XelK.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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}},"created_at":"2021-10-30T12:45:59.000Z","updated_at":"2025-04-14T01:49:24.000Z","dependencies_parsed_at":"2024-09-21T20:00:50.178Z","dependency_job_id":"288aa0df-45d4-4099-9f51-5894d111d5c2","html_url":"https://github.com/XelK/pi_hole_api","commit_stats":{"total_commits":53,"total_committers":3,"mean_commits":"17.666666666666668","dds":"0.26415094339622647","last_synced_commit":"f2ca60bda8a593337cb2748ddd38e8734e030594"},"previous_names":["xelk/pihole_api"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/XelK/pi_hole_api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XelK%2Fpi_hole_api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XelK%2Fpi_hole_api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XelK%2Fpi_hole_api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XelK%2Fpi_hole_api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/XelK","download_url":"https://codeload.github.com/XelK/pi_hole_api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/XelK%2Fpi_hole_api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267216119,"owners_count":24054382,"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","status":"online","status_checked_at":"2025-07-26T02:00:08.937Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-wrapper","codereview","pihole","pip","python3","requests"],"created_at":"2024-12-02T10:12:03.385Z","updated_at":"2025-07-26T19:31:09.264Z","avatar_url":"https://github.com/XelK.png","language":"Python","readme":"# pi_hole_api\n[![Pylint](https://github.com/XelK/pihole_api/actions/workflows/pylint.yml/badge.svg)](https://github.com/XelK/pihole_api/actions/workflows/pylint.yml)\n\n[![Build test](https://github.com/XelK/pi_hole_api/actions/workflows/Build-main.yml/badge.svg)](https://github.com/XelK/pi_hole_api/actions/workflows/Build-main.yml)\n\nPython api module for pi-hole server (https://pi-hole.net/).\nExecute api calls to py-hole server from python code.\n\n## Installation\n```python\n# prod version:\npip install pi-hole-api\n\n# dev version:\npip install -i https://test.pypi.org/simple/ pi-hole-api\n```\n\n## Examples\n### Create class\n```python\nimport pihole_api as pi\npihole = pi.Pihole(\"PI_URL\", \"PI_PSW\")\n```\nwhere:\n- PI_URL: url of pi-hole page\n- PI_PSW: password of pi-hole\n\nor using environment variables \"PI_URL\" and \"PI_PSW\" set to pi-hole url and pi-hole password respectively:\n```python\nimport os\nfrom dotenv import load_dotenv\nimport pihole_api as pi\npihole = pi.Pihole(os.environ[\"PI_URL\"], os.environ[\"PI_PSW\"])\n```\n### Core module\nPermit:\n- enable/disable protection\n```python\npihole.enable()\npihole.disable()\npihole.disable(30) # disable per 30 seconds\n``` \n### Dns module\nPermit:\n- list dns records\n- add/remove A record\n- add/remove CNAME record\n```python\npihole.dns(\"get\") # print dns list\npihole.cname(\"get\") # print cname list\n# add domain to dns\npihole.dns(\"add\", ip_address=\"1.1.1.1\",domain=\"pippo.com\"))\n# remove domain to dns\npihole.dns(\"delete\", ip_address=\"1.1.1.1\",domain=\"pippo.com\"))\n# add cname from pippo.com to pluto.com\npihole.cname(\"add\",\"pippo.com\",\"pluto.com\"))\n# remove cname\npihole.cname(\"delete\",\"pippo.com\",\"pluto.com\"))\n``` \n\n## List module\nPermit:\n-  list/add/change/remove domains to white lists\n-  list/add/change/remove domains to black lists\n```python\n# get white list\npihole.get_domains(\"white\")\n# add to white list\npihole.add_domain(\"white\",\"pippo.it\",\"add pippo\")\n# replace in white list\npihole.replace_domain(\"white\",\"pippo.it\",\"replace pippo\")\n# delete from white list\npihole.delete_domain(\"white\",\"pippo.it\",\"delete pippo\")\n\n# get black list\npihole.get_domains(\"black\")\n# add to black list\npihole.add_domain(\"black\",\"pippo.it\",\"add pippo\")\n# add change in black list\npihole.replace_domain(\"black\",\"pippo.it\",\"replace pippo\")\n# delete from black list\npihole.delete_domain(\"black\",\"pippo.it\",\"delete pippo\")\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FXelK%2Fpi_hole_api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FXelK%2Fpi_hole_api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FXelK%2Fpi_hole_api/lists"}