pi_hole_api
Python api module for pi-hole server (https://pi-hole.net/). Execute api calls to py-hole server from python code.
Installation
# prod version:
pip install pi-hole-api
# dev version:
pip install -i https://test.pypi.org/simple/ pi-hole-api
Examples
Create class
import pihole_api as pi
pihole = pi.Pihole("PI_URL", "PI_PSW")
where:
- PI_URL: url of pi-hole page
- PI_PSW: password of pi-hole
or using environment variables "PI_URL" and "PI_PSW" set to pi-hole url and pi-hole password respectively:
import os
from dotenv import load_dotenv
import pihole_api as pi
pihole = pi.Pihole(os.environ["PI_URL"], os.environ["PI_PSW"])
Core module
Permit:
- enable/disable protection
pihole.enable()
pihole.disable()
pihole.disable(30) # disable per 30 seconds
Dns module
Permit:
- list dns records
- add/remove A record
- add/remove CNAME record
pihole.dns("get") # print dns list
pihole.cname("get") # print cname list
# add domain to dns
pihole.dns("add", ip_address="1.1.1.1",domain="pippo.com"))
# remove domain to dns
pihole.dns("delete", ip_address="1.1.1.1",domain="pippo.com"))
# add cname from pippo.com to pluto.com
pihole.cname("add","pippo.com","pluto.com"))
# remove cname
pihole.cname("delete","pippo.com","pluto.com"))
List module
Permit:
- list/add/change/remove domains to white lists
- list/add/change/remove domains to black lists
# get white list
pihole.get_domains("white")
# add to white list
pihole.add_domain("white","pippo.it","add pippo")
# replace in white list
pihole.replace_domain("white","pippo.it","replace pippo")
# delete from white list
pihole.delete_domain("white","pippo.it","delete pippo")
# get black list
pihole.get_domains("black")
# add to black list
pihole.add_domain("black","pippo.it","add pippo")
# add change in black list
pihole.replace_domain("black","pippo.it","replace pippo")
# delete from black list
pihole.delete_domain("black","pippo.it","delete pippo")
Metadata
Release files for pi-hole-api 0.1.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pi_hole_api-0.1.5.tar.gz | 4.6 kB | Without provenance | Details for pi_hole_api-0.1.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pi_hole_api-0.1.5-py3-none-any.whl | Python 3 | none | any | Details for pi_hole_api-0.1.5-py3-none-any.whl |
Total release size: 10.4 kB
Release files / pi_hole_api-0.1.5.tar.gz
| Download URL | pi_hole_api-0.1.5.tar.gz |
|---|---|
| Size | 4.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7dc18fa7ec20062e3329f02dade7856309d5b1ac607827b59ef5f1c2d1471818
|
|
BLAKE2b-256 checksum How to use checksums |
a5e99f35b678dd41dec50b8c3b1a83532b5b2fd6599db8ec8310a89de95ba5df
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Release files / pi_hole_api-0.1.5-py3-none-any.whl
| Download URL | pi_hole_api-0.1.5-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
991d1fbf30d408bd61ea00a93024d4353715e9d22605da8b3692eb661c2201ad
|
|
BLAKE2b-256 checksum How to use checksums |
6b1525ad792d59109f2ed4f00651b5ff6430c985bfb80e1ce2f25a0142322d84
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
|
Security for pi-hole-api 0.1.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.