{"id":25650639,"url":"https://github.com/sbarbett/pihole6api","last_synced_at":"2025-09-08T22:37:28.712Z","repository":{"id":278868236,"uuid":"937039922","full_name":"sbarbett/pihole6api","owner":"sbarbett","description":"A Python client for the PiHole API","archived":false,"fork":false,"pushed_at":"2025-06-03T14:43:09.000Z","size":55,"stargazers_count":20,"open_issues_count":1,"forks_count":5,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-05T04:14:51.719Z","etag":null,"topics":["api","pihole","python","sdk"],"latest_commit_sha":null,"homepage":"https://shane.barbetta.me","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/sbarbett.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","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,"zenodo":null}},"created_at":"2025-02-22T07:24:09.000Z","updated_at":"2025-06-30T17:45:40.000Z","dependencies_parsed_at":null,"dependency_job_id":"5412d68a-3450-44e9-876e-3a2074151493","html_url":"https://github.com/sbarbett/pihole6api","commit_stats":null,"previous_names":["sbarbett/pihole6api"],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/sbarbett/pihole6api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbarbett%2Fpihole6api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbarbett%2Fpihole6api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbarbett%2Fpihole6api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbarbett%2Fpihole6api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sbarbett","download_url":"https://codeload.github.com/sbarbett/pihole6api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sbarbett%2Fpihole6api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274231349,"owners_count":25245659,"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-09-08T02:00:09.813Z","response_time":121,"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","pihole","python","sdk"],"created_at":"2025-02-23T15:17:12.474Z","updated_at":"2025-09-08T22:37:28.698Z","avatar_url":"https://github.com/sbarbett.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🍓 pihole6api\n\nThis package provides a simple, modular SDK for the PiHole 6 REST API.\n\n## Features\n\n* Automatically handles authentication and renewal\n* Graceful error management\n* Logically organized modules\n* Easily maintained\n\n## Installation\n\n**Install using `pip`:**\n\n```bash\npip install pihole6api\n```\n\n**Install from source:**\n\n```bash\ngit clone https://github.com/sbarbett/pihole6api.git\ncd pihole6api\npip install -e .\n```\n\n## Quick Start\n\n### Initialize the Client\n\n```python\nfrom pihole6api import PiHole6Client\nclient = PiHole6Client(\"https://your-pihole.local/\", \"your-password\")\n```\n\n### Example Usage\n\n#### Get Pi-Hole Metrics\n\n```python\nhistory = client.metrics.get_history()\nprint(history)  # {'history': [{'timestamp': 1740120900, 'total': 0, 'cached': 0 ...}]}\nqueries = client.metrics.get_queries()\nprint(queries)\n```\n\n#### Enable/Disable Blocking\n\n```python\nclient.dns_control.set_blocking_status(False, 60)\nprint(client.dns_control.get_blocking_status()) # {'blocking': 'disabled', 'timer': 60 ...}\n```\n\n#### Manage Groups\n\n```python\nclient.group_management.add_group(\"Custom Group\", comment=\"For testing\")\nclient.group_management.delete_group(\"Custom Group\")\n```\n\n#### Manage Domains\n\n```python\nclient.domain_management.add_domain(\"ads.example.com\", \"deny\", \"exact\")\nclient.domain_management.delete_domain(\"ads.example.com\", \"deny\", \"exact\")\n```\n\n#### Manage Links\n\n```python\nclient.list_management.add_list(\"https://example.com/blocklist.txt\", \"block\")\nclient.list_management.delete_list(\"https://example.com/blocklist.txt\", \"block\")\n```\n\n#### Export/Import PiHole Settings\n\n```python\n# Export settings and save as a .zip file\nwith open(\"pihole-settings.zip\", \"wb\") as f:\n    f.write(client.config.export_settings())\n\nclient.config.import_settings(\"pihole-settings.zip\", {\"config\": True, \"gravity\": {\"group\": True}})\n```\n\n#### Flush Logs \u0026 Restart DNS\n\n```python\nclient.actions.flush_logs()\nclient.actions.restart_dns()\n```\n\n## API Modules\n\n| Module                | Description |\n|----------------------|-------------|\n| `metrics`           | Query history, top clients/domains, DNS stats |\n| `dns_control`       | Enable/disable blocking |\n| `group_management`  | Create, update, and delete groups |\n| `domain_management` | Allow/block domains (exact \u0026 regex) |\n| `client_management` | Manage client-specific rules |\n| `list_management`   | Manage blocklists (Adlists) |\n| `config`            | Modify Pi-hole configuration |\n| `ftl_info`          | Get Pi-hole core process (FTL) info |\n| `dhcp`              | Manage DHCP leases |\n| `network_info`      | View network devices, interfaces, routes |\n| `actions`           | Flush logs, restart services |\n\n## Contributing\n\nPlease check [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines.\n\n## Changelog\n\nSee [CHANGELOG.md](CHANGELOG.md) for a list of changes.\n\n## License\n\nThis project is license under the [MIT license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbarbett%2Fpihole6api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsbarbett%2Fpihole6api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsbarbett%2Fpihole6api/lists"}