pihole6api 0.1.6__py3-none-any.whl → 0.1.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pihole6api/client_management.py +6 -0
- pihole6api/list_management.py +2 -2
- pihole6api/metrics.py +20 -5
- {pihole6api-0.1.6.dist-info → pihole6api-0.1.8.dist-info}/METADATA +3 -2
- {pihole6api-0.1.6.dist-info → pihole6api-0.1.8.dist-info}/RECORD +8 -8
- {pihole6api-0.1.6.dist-info → pihole6api-0.1.8.dist-info}/WHEEL +1 -1
- {pihole6api-0.1.6.dist-info → pihole6api-0.1.8.dist-info/licenses}/LICENSE +0 -0
- {pihole6api-0.1.6.dist-info → pihole6api-0.1.8.dist-info}/top_level.txt +0 -0
pihole6api/client_management.py
CHANGED
@@ -47,6 +47,12 @@ class PiHole6ClientManagement:
|
|
47
47
|
:param client: Client identifier (IP, MAC, hostname, or interface).
|
48
48
|
"""
|
49
49
|
return self.connection.get(f"clients/{client}")
|
50
|
+
|
51
|
+
def get_clients(self):
|
52
|
+
"""
|
53
|
+
Retrieve information about all clients.
|
54
|
+
"""
|
55
|
+
return self.connection.get(f"clients")
|
50
56
|
|
51
57
|
def update_client(self, client, comment=None, groups=None):
|
52
58
|
"""
|
pihole6api/list_management.py
CHANGED
@@ -36,8 +36,8 @@ class PiHole6ListManagement:
|
|
36
36
|
"""
|
37
37
|
Delete multiple lists.
|
38
38
|
|
39
|
-
:param lists: List of dictionaries with keys "
|
40
|
-
Example: [{"
|
39
|
+
:param lists: List of dictionaries with keys "item" and "type".
|
40
|
+
Example: [{"item": "https://example.com/blocklist.txt", "type": "block"}]
|
41
41
|
"""
|
42
42
|
if not isinstance(lists, list):
|
43
43
|
raise ValueError("lists must be a list of dictionaries.")
|
pihole6api/metrics.py
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
import warnings
|
2
|
+
|
1
3
|
class PiHole6Metrics:
|
2
4
|
def __init__(self, connection):
|
3
5
|
"""
|
@@ -41,11 +43,12 @@ class PiHole6Metrics:
|
|
41
43
|
return self.connection.get("history/database/clients", params=params)
|
42
44
|
|
43
45
|
# Query API Endpoints
|
44
|
-
def get_queries(self,
|
46
|
+
def get_queries(self, length=100, from_ts=None, until_ts=None, upstream=None, domain=None, client=None, cursor=None, **kwargs):
|
45
47
|
"""
|
46
48
|
Get query log with optional filtering parameters.
|
47
49
|
|
48
|
-
:param int
|
50
|
+
:param int length: Number of queries to retrieve (default: 100).
|
51
|
+
(Note: The old parameter 'n' is deprecated and will be removed in a future version.)
|
49
52
|
:param int from_ts: Unix timestamp to filter queries from this time onward (optional).
|
50
53
|
:param int until_ts: Unix timestamp to filter queries up to this time (optional).
|
51
54
|
:param str upstream: Filter queries sent to a specific upstream destination (optional).
|
@@ -53,19 +56,31 @@ class PiHole6Metrics:
|
|
53
56
|
:param str client: Filter queries originating from a specific client (optional).
|
54
57
|
:param str cursor: Cursor for pagination to fetch the next chunk of results (optional).
|
55
58
|
"""
|
59
|
+
# Check for deprecated "n" parameter
|
60
|
+
if "n" in kwargs:
|
61
|
+
warnings.warn(
|
62
|
+
"The 'n' parameter is deprecated; please use 'length' instead.",
|
63
|
+
DeprecationWarning,
|
64
|
+
stacklevel=2
|
65
|
+
)
|
66
|
+
length = kwargs.pop("n")
|
67
|
+
|
68
|
+
if kwargs:
|
69
|
+
raise TypeError("Unexpected keyword arguments: " + ", ".join(kwargs.keys()))
|
70
|
+
|
56
71
|
params = {
|
57
|
-
"
|
72
|
+
"length": length,
|
58
73
|
"from": from_ts,
|
59
74
|
"until": until_ts,
|
60
75
|
"upstream": upstream,
|
61
76
|
"domain": domain,
|
62
77
|
"client": client,
|
63
|
-
"cursor": cursor
|
78
|
+
"cursor": cursor,
|
64
79
|
}
|
80
|
+
# Remove any parameters that are None
|
65
81
|
params = {k: v for k, v in params.items() if v is not None}
|
66
82
|
return self.connection.get("queries", params=params)
|
67
83
|
|
68
|
-
|
69
84
|
def get_query_suggestions(self):
|
70
85
|
"""Get query filter suggestions"""
|
71
86
|
return self.connection.get("queries/suggestions")
|
@@ -1,6 +1,6 @@
|
|
1
|
-
Metadata-Version: 2.
|
1
|
+
Metadata-Version: 2.4
|
2
2
|
Name: pihole6api
|
3
|
-
Version: 0.1.
|
3
|
+
Version: 0.1.8
|
4
4
|
Summary: Python API Client for Pi-hole 6
|
5
5
|
Author-email: Shane Barbetta <shane@barbetta.me>
|
6
6
|
License: MIT
|
@@ -22,6 +22,7 @@ Requires-Python: >=3.8
|
|
22
22
|
Description-Content-Type: text/markdown
|
23
23
|
License-File: LICENSE
|
24
24
|
Requires-Dist: requests>=2.26.0
|
25
|
+
Dynamic: license-file
|
25
26
|
|
26
27
|
# 🍓 pihole6api
|
27
28
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
pihole6api/__init__.py,sha256=OKDAH2I6UjXcBmcj6rn5aNg5J60GCUBVFJ-_t83GiVQ,898
|
2
2
|
pihole6api/actions.py,sha256=8CBkr8nYfT8yfdCO6F9M9nompaYcFdsaYGiEa1eVDCw,693
|
3
3
|
pihole6api/client.py,sha256=HYdRh3CSZJ0srbkpjIVnLo-iy1avqKDUne5ji2Aq394,2013
|
4
|
-
pihole6api/client_management.py,sha256=
|
4
|
+
pihole6api/client_management.py,sha256=n8Ra_6pRL3Q9jlIK3kIK9bmh74MTfxgYnOHYaUwYGNs,2590
|
5
5
|
pihole6api/config.py,sha256=NdBHOudz147oIs5YVR3U4WLvqk3hU3HlZHnshy1NK4g,4680
|
6
6
|
pihole6api/conn.py,sha256=60Q9paDCD6Bwmdg_G9mOUr86Hzj9G-dhMwL7F3NvLB8,5837
|
7
7
|
pihole6api/dhcp.py,sha256=1A3z-3q9x51-6MOC3JMl7yR_5pHmRxZtMWtPqzWxYm0,629
|
@@ -9,11 +9,11 @@ pihole6api/dns_control.py,sha256=mxV3AIuGCsx0-1ibpMXor9QUGd_fDFfeaUENPhIK_TY,853
|
|
9
9
|
pihole6api/domain_management.py,sha256=vxhQSG5F8EFDGqtiNkF0H_KOWFMerXaAuJZT0nMa8ec,3492
|
10
10
|
pihole6api/ftl_info.py,sha256=FINHFotI1sQgkL0OPaNqW-rk4h1ua6QHnRh5gFXXRIE,3210
|
11
11
|
pihole6api/group_management.py,sha256=Iip2Na4pUYgC5K9cwOWv_OPD6qdXRzWCmlS-fJlBMjU,2372
|
12
|
-
pihole6api/list_management.py,sha256=
|
13
|
-
pihole6api/metrics.py,sha256=
|
12
|
+
pihole6api/list_management.py,sha256=CooTeF4EmNPFwnzGoLbHFMhCePJ-ojvRGx7Sxzayy-U,4170
|
13
|
+
pihole6api/metrics.py,sha256=QWqV_7SytMPGEBEZOxsIfxTa6lM9Ksrvlf2BXjDKZmA,7991
|
14
14
|
pihole6api/network_info.py,sha256=E1qQ7DsCb7qplt0oQIyKhUY12ExNF6bv6thm9rbNqwY,1953
|
15
|
-
pihole6api-0.1.
|
16
|
-
pihole6api-0.1.
|
17
|
-
pihole6api-0.1.
|
18
|
-
pihole6api-0.1.
|
19
|
-
pihole6api-0.1.
|
15
|
+
pihole6api-0.1.8.dist-info/licenses/LICENSE,sha256=hpO6J6J9O1VZxZeHQTxKMTmuobaHbApiZxp279I4xNU,1062
|
16
|
+
pihole6api-0.1.8.dist-info/METADATA,sha256=LqrKT8Vpxgqtithi4sPa80xMEIBWmpKGUrAYN7G3nyQ,3790
|
17
|
+
pihole6api-0.1.8.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
18
|
+
pihole6api-0.1.8.dist-info/top_level.txt,sha256=Qrh46lxEC54rBR8T53em-tuZLWbmi1SDwL1rOhsgrME,11
|
19
|
+
pihole6api-0.1.8.dist-info/RECORD,,
|
File without changes
|
File without changes
|