{ "info": { "author": "Evan Pratten", "author_email": "ewpratten@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 3" ], "description": "[![PyPI version](https://badge.fury.io/py/PiHole-api.svg)](https://badge.fury.io/py/PiHole-api)\n# PiHole-api\nA python3 wrapper for the pihole api that aims to eventually be a full replacement for the [AdminLTE](https://github.com/pi-hole/AdminLTE) web panel\n\n## Installing\nTo install the package from pip, first run:\n```bash\npython3 -m pip install --no-cache-dir PiHole-api\n```\n\nDue to naming issues, inside python, the package is named `pihole` **not** `PiHole-api`. Keeping this in mind, let's import it.\n```python3\nimport pihole as ph\n```\n\n## Usage\nThis library has many features that can be broken down in to two simple sections. Stats, and Controls. In order to use any of the functions, you must first import the library, then create a PiHole object.\n\n```python3\n# Import the library\nimport pihole as ph\n\n# Create an object\npihole = ph.PiHole(\"\")\n```\nThrouought this README, I will assume that you are using the name `pihole` for your object\n\n### Stats\nChecking the current version data can be done using:\n```python3\npihole.getVersion()\n```\nIt will return a json object that will look like:\n```json\n{'core_update': False, 'web_update': False, 'FTL_update': False, 'core_current': 'v4.0', 'web_current': 'v4.0', 'FTL_current': 'v4.0', 'core_latest': 'v4.0', 'web_latest': 'v4.0', 'FTL_latest': 'v4.0', 'core_branch': 'master', 'web_branch': 'master', 'FTL_branch': ''}\n```\n\nTo refresh all stat-related data:\n```python3\npihole.refresh()\n```\n\nTo access the fetched data, use these self-descriptive variables:\n```python3\npihole.status\npihole.domain_count\npihole.queries\npihole.blocked\npihole.ads_percentage\npihole.unique_domains\npihole.forwarded\npihole.cached\npihole.total_clients\npihole.unique_clients\npihole.total_queries\n```\n\nIf you have already [authenticated](#Controls), the `refresh()` function will also return data about the top devices, forward destinations, and query types. These can be accessed using:\n```python3\n# Top devices\npihole.top_devices\n\n# Forward destinations\npihole.forward_destinations\n\n# Query types\npihole.query_types\n```\n\nTo get data about the last gravity update, use:\n```python3\npihole.gravity_last_updated\n```\n\nIt will return a json object that looks like:\n```json\n{'file_exists': True, 'absolute': 1534793121, 'relative': {'days': '0', 'hours': '00', 'minutes': '42'}}\n```\n\nYou can also get the graph data using:\n```python3\npihole.getGraphData()\n```\n\nThe data it returns looks like this:\n```json\n{'domains': {'1534712100': 3, '1534712700': 87, '1534713300': 41, '1534713900': 45, '1534714500': 1, '1534715100': 28, '1534715700': 26, '1534716300': 0, '1534716900': 0, '1534717500': 0, '1534718100': 0, '1534718700': 0, '1534719300': 0, '1534719900': 0, '1534720500': 0, '1534721100': 0, '1534721700': 0, '1534722300': 0, '1534722900': 22, '1534723500': 5, '1534724100': 6, '1534724700': 2, '1534725300': 0, '1534725900': 3, '1534726500': 15, '1534727100': 1, '1534727700': 0, '1534728300': 0, '1534728900': 10, '1534729500': 8, '1534730100': 5, '1534730700': 0, '1534731300': 0, '1534731900': 0, '1534732500': 0, '1534733100': 0, '1534733700': 0, '1534734300': 0, '1534734900': 0, '1534735500': 0, '1534736100': 0, '1534736700': 0, '1534737300': 0, '1534737900': 0, '1534738500': 0, '1534739100': 0, '1534739700': 0, '1534740300': 0, '1534740900': 0, '1534741500': 0, '1534742100': 0, '1534742700': 0, '1534743300': 0, '1534743900': 0, '1534744500': 0, '1534745100': 0, '1534745700': 0, '1534746300': 0, '1534746900': 0, '1534747500': 0, '1534748100': 0, '1534748700': 0, '1534749300': 0, '1534749900': 0, '1534750500': 0, '1534751100': 0, '1534751700': 0, '1534752300': 0, '1534752900': 0, '1534753500': 0, '1534754100': 0, '1534754700': 0, '1534755300': 0, '1534755900': 0, '1534756500': 0, '1534757100': 0, '1534757700': 0, '1534758300': 0, '1534758900': 0, '1534759500': 0, '1534760100': 0, '1534760700': 0, '1534761300': 0, '1534761900': 0, '1534762500': 0, '1534763100': 0, '1534763700': 0, '1534764300': 0, '1534764900': 0, '1534765500': 0, '1534766100': 0, '1534766700': 0, '1534767300': 0, '1534767900': 0, '1534768500': 0, '1534769100': 0, '1534769700': 0, '1534770300': 0, '1534770900': 0, '1534771500': 0, '1534772100': 0, '1534772700': 0, '1534773300': 0, '1534773900': 0, '1534774500': 0, '1534775100': 0, '1534775700': 71, '1534776300': 61, '1534776900': 53, '1534777500': 27, '1534778100': 101, '1534778700': 118, '1534779300': 24, '1534779900': 6, '1534780500': 7, '1534781100': 37, '1534781700': 106, '1534782300': 142, '1534782900': 54, '1534783500': 79, '1534784100': 90, '1534784700': 71, '1534785300': 77, '1534785900': 90, '1534786500': 86, '1534787100': 72, '1534787700': 95, '1534788300': 98, '1534788900': 35, '1534789500': 31, '1534790100': 17, '1534790700': 32, '1534791300': 49, '1534791900': 43, '1534792500': 66, '1534793100': 131, '1534793700': 68, '1534794300': 48, '1534794900': 43, '1534795500': 45, '1534796100': 46, '1534796700': 26}, 'ads': {'1534712100': 0, '1534712700': 6, '1534713300': 0, '1534713900': 0, '1534714500': 0, '1534715100': 0, '1534715700': 0, '1534716300': 0, '1534716900': 0, '1534717500': 0, '1534718100': 0, '1534718700': 0, '1534719300': 0, '1534719900': 0, '1534720500': 0, '1534721100': 0, '1534721700': 0, '1534722300': 0, '1534722900': 0, '1534723500': 0, '1534724100': 0, '1534724700': 0, '1534725300': 0, '1534725900': 0, '1534726500': 0, '1534727100': 0, '1534727700': 0, '1534728300': 0, '1534728900': 0, '1534729500': 0, '1534730100': 0, '1534730700': 0, '1534731300': 0, '1534731900': 0, '1534732500': 0, '1534733100': 0, '1534733700': 0, '1534734300': 0, '1534734900': 0, '1534735500': 0, '1534736100': 0, '1534736700': 0, '1534737300': 0, '1534737900': 0, '1534738500': 0, '1534739100': 0, '1534739700': 0, '1534740300': 0, '1534740900': 0, '1534741500': 0, '1534742100': 0, '1534742700': 0, '1534743300': 0, '1534743900': 0, '1534744500': 0, '1534745100': 0, '1534745700': 0, '1534746300': 0, '1534746900': 0, '1534747500': 0, '1534748100': 0, '1534748700': 0, '1534749300': 0, '1534749900': 0, '1534750500': 0, '1534751100': 0, '1534751700': 0, '1534752300': 0, '1534752900': 0, '1534753500': 0, '1534754100': 0, '1534754700': 0, '1534755300': 0, '1534755900': 0, '1534756500': 0, '1534757100': 0, '1534757700': 0, '1534758300': 0, '1534758900': 0, '1534759500': 0, '1534760100': 0, '1534760700': 0, '1534761300': 0, '1534761900': 0, '1534762500': 0, '1534763100': 0, '1534763700': 0, '1534764300': 0, '1534764900': 0, '1534765500': 0, '1534766100': 0, '1534766700': 0, '1534767300': 0, '1534767900': 0, '1534768500': 0, '1534769100': 0, '1534769700': 0, '1534770300': 0, '1534770900': 0, '1534771500': 0, '1534772100': 0, '1534772700': 0, '1534773300': 0, '1534773900': 0, '1534774500': 0, '1534775100': 0, '1534775700': 3, '1534776300': 19, '1534776900': 21, '1534777500': 12, '1534778100': 23, '1534778700': 40, '1534779300': 12, '1534779900': 3, '1534780500': 5, '1534781100': 9, '1534781700': 11, '1534782300': 39, '1534782900': 13, '1534783500': 13, '1534784100': 18, '1534784700': 12, '1534785300': 6, '1534785900': 19, '1534786500': 14, '1534787100': 7, '1534787700': 17, '1534788300': 26, '1534788900': 18, '1534789500': 10, '1534790100': 9, '1534790700': 10, '1534791300': 24, '1534791900': 13, '1534792500': 19, '1534793100': 21, '1534793700': 8, '1534794300': 7, '1534794900': 4, '1534795500': 7, '1534796100': 6, '1534796700': 4}}\n```\n\nYou can grab just the domain data by using:\n```python3\npihole.getGraphData()[\"domains\"]\n```\n\nAnd just the ads data by using:\n```python3\npihole.getGraphData()[\"ads\"]\n```\n\nTo refresh the top data, first [authenticate](#Controls), then use:\n```python3\npihole.refreshTop(10)\n```\nReplace the `10` with how many results you want back.\n\nThe top data can then be fetched using:\n```python3\npihole.top_queries # returns all top queries\n\n# Or\n\npihole.top_ads # returns all top ads\n```\n\nTo view all queries, use:\n```python3\npihole.getAllQueries()\n```\n\nThis returns a list of lists containing data about all queries. Fore more info, see the getAllQueries section of: https://discourse.pi-hole.net/t/pi-hole-api/1863\n\nTo get the filesize of the database file, use:\n```python3\npihole.getDBfilesize()\n```\n\nTo get the contents of your white/black list, use:\n```python3\npihole.getList(\"black\")\n```\n\"black\" can be replaced with \"white\" to get your whitelist\n\n\n\n###
Controls
\nFirst, you must log in. Use the password you set or where given by the installer (the same one you use on the web control panel)\n```python3\npihole.authenticate(password)\n```\n\nTo enable pihole, authenticate, then use:\n```python3\npihole.enable()\n```\n\nTo disable pihole, authenticate, then use:\n```python3\npihole.disable(10)\n```\nreplace `10` with the number of **seconds** that you want to disable pihole for.\n\nAdd a domain to one of your lists:\n```python3\npihole.add(\"black\", \"google.com\")\n```\nThe example blacklists google.com. Replacing black with one of: **white**, **black**, **wild**, **regex**, or **audit** will change the list to be added to. To remove a domain form a list, replace `add()` with `sub()`", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/Ewpratten/PiHole-api", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "PiHole-api", "package_url": "https://pypi.org/project/PiHole-api/", "platform": "", "project_url": "https://pypi.org/project/PiHole-api/", "project_urls": { "Homepage": "https://github.com/Ewpratten/PiHole-api" }, "release_url": "https://pypi.org/project/PiHole-api/2.0/", "requires_dist": null, "requires_python": "", "summary": "A python3 wrapper for the pihole api that aims to eventually be a full replacement for the AdminLTE web panel", "version": "2.0" }, "last_serial": 4194426, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "8f3f18cac6aec2bcac79aa1020383b20", "sha256": "a0247100d028decc51f1fe6ba9e3ffb3da753c64f318451040697ac98b4718b6" }, "downloads": -1, "filename": "PiHole-api-1.0.tar.gz", "has_sig": false, "md5_digest": "8f3f18cac6aec2bcac79aa1020383b20", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3072, "upload_time": "2018-08-20T21:21:48", "url": "https://files.pythonhosted.org/packages/1b/9c/9c7096642013b90ac5379884accd465325334f40170eed287f3b4ac720c5/PiHole-api-1.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "89ac8394177471b9f0f5be49c499c362", "sha256": "153ade29b5eae0a4ec487ba41044f63c935fd587b0bdc6360397c4645df6bfa6" }, "downloads": -1, "filename": "PiHole-api-1.0.1.tar.gz", "has_sig": false, "md5_digest": "89ac8394177471b9f0f5be49c499c362", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3072, "upload_time": "2018-08-20T21:22:49", "url": "https://files.pythonhosted.org/packages/77/a9/eddb7f0e0a2d3512a774f61c955e44e3448640de021c358622a71cbfed2c/PiHole-api-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "20bb7a1cac78c507105d9611f0a2ad0c", "sha256": "5fc1279de76c6c180b09d673b35871405d909c5aaf89e42e16b08e843920cf7b" }, "downloads": -1, "filename": "PiHole-api-1.0.2.tar.gz", "has_sig": false, "md5_digest": "20bb7a1cac78c507105d9611f0a2ad0c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3450, "upload_time": "2018-08-20T21:24:14", "url": "https://files.pythonhosted.org/packages/d1/6f/01aed0d9ee0ec199a368a5602b3044ca7ba9063b46663f33cf83683a5b66/PiHole-api-1.0.2.tar.gz" } ], "1.0.3": [ { "comment_text": "", "digests": { "md5": "71d5f79c269f13e8bb50619b5a58e31c", "sha256": "a20fb22b5738071043ba2e48496b94af5fdbabd958500248e948442b76dbfcf5" }, "downloads": -1, "filename": "PiHole-api-1.0.3.tar.gz", "has_sig": false, "md5_digest": "71d5f79c269f13e8bb50619b5a58e31c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3445, "upload_time": "2018-08-20T21:26:07", "url": "https://files.pythonhosted.org/packages/6e/5b/40d6be0ab80495d008af556b05bcd5ac5662ef19e21a3298d6073ca4bcb0/PiHole-api-1.0.3.tar.gz" } ], "1.0.4": [ { "comment_text": "", "digests": { "md5": "e99cb24c4e65ad98930b60b99dc7463f", "sha256": "cf6530e9afbed4c0c9f283370efaabe732c4d71ed87261898f42fa41a9d52af4" }, "downloads": -1, "filename": "PiHole-api-1.0.4.tar.gz", "has_sig": false, "md5_digest": "e99cb24c4e65ad98930b60b99dc7463f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3428, "upload_time": "2018-08-20T21:27:33", "url": "https://files.pythonhosted.org/packages/d2/61/5ed4ed5538fe2136685920f36ffe1e2b4cf5237ffd05fc6746df86e90703/PiHole-api-1.0.4.tar.gz" } ], "1.0.5": [ { "comment_text": "", "digests": { "md5": "337cb921e55e5c6c9a8afa23459bf891", "sha256": "0fb811d505865a8f4010cbffd4b66125766fc51bf1ca3d0cfc2591a88c645f9f" }, "downloads": -1, "filename": "PiHole-api-1.0.5.tar.gz", "has_sig": false, "md5_digest": "337cb921e55e5c6c9a8afa23459bf891", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4332, "upload_time": "2018-08-20T21:33:43", "url": "https://files.pythonhosted.org/packages/92/e2/fb75b29c8b51da636ccefb3a753cdd1f25836e246105f1386aa7c48eb605/PiHole-api-1.0.5.tar.gz" } ], "1.0.6": [ { "comment_text": "", "digests": { "md5": "23863ddda6037e9c6bd2bbb53602ba68", "sha256": "301943fa421256753ce2847dff9c8b48f89a4d9d5303ef79f844b73a60d6dc86" }, "downloads": -1, "filename": "PiHole-api-1.0.6.tar.gz", "has_sig": false, "md5_digest": "23863ddda6037e9c6bd2bbb53602ba68", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4334, "upload_time": "2018-08-20T21:35:42", "url": "https://files.pythonhosted.org/packages/41/9f/305eee3f5726226842f600e933e6631a6e4ae14b409c1a8fac2d5d375195/PiHole-api-1.0.6.tar.gz" } ], "1.1": [ { "comment_text": "", "digests": { "md5": "8cf6afb4b4c320d412ab040c16de59a5", "sha256": "1ba7b3e1e90274ea6148ad2108b98f8d2833fcd749096e37786175f2a7fd275f" }, "downloads": -1, "filename": "PiHole-api-1.1.tar.gz", "has_sig": false, "md5_digest": "8cf6afb4b4c320d412ab040c16de59a5", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4484, "upload_time": "2018-08-20T21:40:49", "url": "https://files.pythonhosted.org/packages/ad/a7/642eb98a270030ec46dc4b211d365e469154c2d094b48c46dad925bf7a38/PiHole-api-1.1.tar.gz" } ], "1.1.1": [ { "comment_text": "", "digests": { "md5": "a39fcf2cf3999435b88886250984b314", "sha256": "eb34baac219e88b7541d417ebf506cdc5e5badf82f5589018c27e2326df210da" }, "downloads": -1, "filename": "PiHole-api-1.1.1.tar.gz", "has_sig": false, "md5_digest": "a39fcf2cf3999435b88886250984b314", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4501, "upload_time": "2018-08-20T21:43:19", "url": "https://files.pythonhosted.org/packages/51/64/ce28d646443377a6e4180e782c6ec418c1462dc49cbe0e221303f746531e/PiHole-api-1.1.1.tar.gz" } ], "2.0": [ { "comment_text": "", "digests": { "md5": "a9b1b3691d1537a83ed3e45c1f301092", "sha256": "113252d765427c76394cee6e127c20eab01f6985df61716b34ee29320313f641" }, "downloads": -1, "filename": "PiHole-api-2.0.tar.gz", "has_sig": false, "md5_digest": "a9b1b3691d1537a83ed3e45c1f301092", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5187, "upload_time": "2018-08-22T00:17:05", "url": "https://files.pythonhosted.org/packages/b6/0f/7f154d6fdfa754cb757a4ffebe0e13debbc43d41ee207c57f58215c1baba/PiHole-api-2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "a9b1b3691d1537a83ed3e45c1f301092", "sha256": "113252d765427c76394cee6e127c20eab01f6985df61716b34ee29320313f641" }, "downloads": -1, "filename": "PiHole-api-2.0.tar.gz", "has_sig": false, "md5_digest": "a9b1b3691d1537a83ed3e45c1f301092", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5187, "upload_time": "2018-08-22T00:17:05", "url": "https://files.pythonhosted.org/packages/b6/0f/7f154d6fdfa754cb757a4ffebe0e13debbc43d41ee207c57f58215c1baba/PiHole-api-2.0.tar.gz" } ] }