Name | politikontroller-py JSON |
Version |
3.3.2
JSON |
| download |
home_page | None |
Summary | Unofficial client for politikontroller.no |
upload_time | 2024-12-09 06:23:44 |
maintainer | None |
docs_url | None |
author | Bendik R. Brenne |
requires_python | <3.13,>=3.10 |
license | MIT |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# politikontroller-py
[![GitHub Release][releases-shield]][releases]
[![Python Versions][py-versions-shield]][py-versions]
![Project Maintenance][maintenance-shield]
[![License][license-shield]](LICENSE)
![Made with Love in Norway][madewithlove-shield]
[![Build Status][build-shield]][build]
[![Code coverage][codecov-shield]][codecov]
## Install
```bash
pip install politikontroller-py
```
## Usage
### Basic usage
```python
from politikontroller_py import Client
client = Client.initialize("4790112233", "super-secret")
async def main():
police_controls = await client.get_controls(63, 11)
print(police_controls)
```
### With account
```python
from politikontroller_py import Client
from politikontroller_py.models import Account
# A valid registered user @ politikontroller.no
user = Account(
username="4790112233", # Include 2 digit prefix - or else DEFAULT_COUNTRY is assumed
password="super-secret",
)
client = Client(user)
async def main():
police_controls = await client.get_controls(63, 11)
print(police_controls)
```
### With session
```python
from aiohttp import ClientSession
from politikontroller_py import Client
async def main():
async with ClientSession() as session:
client = Client.initialize("4790112233", "super-secret", session=session)
police_controls = await client.get_controls(63, 11)
print(police_controls)
```
## CLI tool
```bash
$ politikontroller --help
Usage: politikontroller [OPTIONS] COMMAND [ARGS]...
Connect to politikontroller.no and fetch data in a simple way.
Username and password can be defined using env vars.
POLITIKONTROLLER_USERNAME POLITIKONTROLLER_PASSWORD
Options:
-u, --username TEXT Username (i.e. phone number) [required]
-p, --password TEXT Password [required]
--debug Set logging level to DEBUG
--help Show this message and exit.
Commands:
account-auth activate account
account-auth-sms activate account by sms
account-register register new account
account-send-sms send activation sms
check server health check.
exchange-points exchange points (?)
get-control get details on a control.
get-control-types get a list of control types.
get-controls get a list of all active controls.
get-controls-radius get all active controls inside a radius.
get-maps get own maps.
get-settings get own settings.
```
[license-shield]: https://img.shields.io/github/license/bendikrb/politikontroller-py.svg
[license]: https://github.com/bendikrb/politikontroller-py/blob/main/LICENSE
[releases-shield]: https://img.shields.io/pypi/v/politikontroller-py
[releases]: https://github.com/bendikrb/politikontroller-py/releases
[build-shield]: https://github.com/bendikrb/politikontroller-py/actions/workflows/test.yaml/badge.svg
[build]: https://github.com/bendikrb/politikontroller-py/actions/workflows/test.yaml
[maintenance-shield]: https://img.shields.io/maintenance/yes/2024.svg
[py-versions-shield]: https://img.shields.io/pypi/pyversions/politikontroller-py
[py-versions]: https://pypi.org/project/politikontroller-py/
[codecov-shield]: https://codecov.io/gh/bendikrb/politikontroller-py/graph/badge.svg?token=IXLJ3WR4ES
[codecov]: https://codecov.io/gh/bendikrb/politikontroller-py
[madewithlove-shield]: https://madewithlove.now.sh/no?heart=true&colorB=%233584e4
Raw data
{
"_id": null,
"home_page": null,
"name": "politikontroller-py",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.13,>=3.10",
"maintainer_email": null,
"keywords": null,
"author": "Bendik R. Brenne",
"author_email": "bendik@konstant.no",
"download_url": "https://files.pythonhosted.org/packages/b7/30/674d51de4e5854383c6ecb14217361ebf5434b71c2c7fd09e6e40b0a5c26/politikontroller_py-3.3.2.tar.gz",
"platform": null,
"description": "# politikontroller-py\n\n[![GitHub Release][releases-shield]][releases]\n[![Python Versions][py-versions-shield]][py-versions]\n![Project Maintenance][maintenance-shield]\n[![License][license-shield]](LICENSE)\n![Made with Love in Norway][madewithlove-shield]\n\n[![Build Status][build-shield]][build]\n[![Code coverage][codecov-shield]][codecov]\n\n\n## Install\n\n```bash\npip install politikontroller-py\n```\n\n## Usage\n\n### Basic usage\n```python\nfrom politikontroller_py import Client\n\nclient = Client.initialize(\"4790112233\", \"super-secret\")\n\nasync def main():\n police_controls = await client.get_controls(63, 11)\n print(police_controls)\n```\n\n\n### With account\n```python\nfrom politikontroller_py import Client\nfrom politikontroller_py.models import Account\n\n# A valid registered user @ politikontroller.no\nuser = Account(\n username=\"4790112233\", # Include 2 digit prefix - or else DEFAULT_COUNTRY is assumed\n password=\"super-secret\",\n)\n\nclient = Client(user)\n\nasync def main():\n police_controls = await client.get_controls(63, 11)\n print(police_controls)\n```\n\n\n### With session\n```python\nfrom aiohttp import ClientSession\nfrom politikontroller_py import Client\n\nasync def main():\n async with ClientSession() as session:\n client = Client.initialize(\"4790112233\", \"super-secret\", session=session)\n police_controls = await client.get_controls(63, 11)\n print(police_controls)\n```\n\n\n## CLI tool\n\n```bash\n$ politikontroller --help\nUsage: politikontroller [OPTIONS] COMMAND [ARGS]...\n\n Connect to politikontroller.no and fetch data in a simple way.\n\n Username and password can be defined using env vars.\n\n POLITIKONTROLLER_USERNAME POLITIKONTROLLER_PASSWORD\n\nOptions:\n -u, --username TEXT Username (i.e. phone number) [required]\n -p, --password TEXT Password [required]\n --debug Set logging level to DEBUG\n --help Show this message and exit.\n\nCommands:\n account-auth activate account\n account-auth-sms activate account by sms\n account-register register new account\n account-send-sms send activation sms\n check server health check.\n exchange-points exchange points (?)\n get-control get details on a control.\n get-control-types get a list of control types.\n get-controls get a list of all active controls.\n get-controls-radius get all active controls inside a radius.\n get-maps get own maps.\n get-settings get own settings.\n\n```\n\n\n[license-shield]: https://img.shields.io/github/license/bendikrb/politikontroller-py.svg\n[license]: https://github.com/bendikrb/politikontroller-py/blob/main/LICENSE\n[releases-shield]: https://img.shields.io/pypi/v/politikontroller-py\n[releases]: https://github.com/bendikrb/politikontroller-py/releases\n[build-shield]: https://github.com/bendikrb/politikontroller-py/actions/workflows/test.yaml/badge.svg\n[build]: https://github.com/bendikrb/politikontroller-py/actions/workflows/test.yaml\n[maintenance-shield]: https://img.shields.io/maintenance/yes/2024.svg\n[py-versions-shield]: https://img.shields.io/pypi/pyversions/politikontroller-py\n[py-versions]: https://pypi.org/project/politikontroller-py/\n[codecov-shield]: https://codecov.io/gh/bendikrb/politikontroller-py/graph/badge.svg?token=IXLJ3WR4ES\n[codecov]: https://codecov.io/gh/bendikrb/politikontroller-py\n[madewithlove-shield]: https://madewithlove.now.sh/no?heart=true&colorB=%233584e4\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Unofficial client for politikontroller.no",
"version": "3.3.2",
"project_urls": null,
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "0e59fae04e371a5bacf62dd0f38ab81054f1cfc81a2f4e163d4887a524c7b385",
"md5": "d4c079e2b50c65c509a6130021146345",
"sha256": "b7854bf8af1fc017ae7afbd42717d7b1d1eda3edae72e72c88ef8e6d59e987aa"
},
"downloads": -1,
"filename": "politikontroller_py-3.3.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d4c079e2b50c65c509a6130021146345",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.13,>=3.10",
"size": 19433,
"upload_time": "2024-12-09T06:23:43",
"upload_time_iso_8601": "2024-12-09T06:23:43.061707Z",
"url": "https://files.pythonhosted.org/packages/0e/59/fae04e371a5bacf62dd0f38ab81054f1cfc81a2f4e163d4887a524c7b385/politikontroller_py-3.3.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b730674d51de4e5854383c6ecb14217361ebf5434b71c2c7fd09e6e40b0a5c26",
"md5": "813a4f23ce5f9473489b0596e0b0c545",
"sha256": "16772bb589519d8d2471b6354eae7ec868e2f53cb4e7cae6b5f763dfb2205206"
},
"downloads": -1,
"filename": "politikontroller_py-3.3.2.tar.gz",
"has_sig": false,
"md5_digest": "813a4f23ce5f9473489b0596e0b0c545",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.13,>=3.10",
"size": 16562,
"upload_time": "2024-12-09T06:23:44",
"upload_time_iso_8601": "2024-12-09T06:23:44.710375Z",
"url": "https://files.pythonhosted.org/packages/b7/30/674d51de4e5854383c6ecb14217361ebf5434b71c2c7fd09e6e40b0a5c26/politikontroller_py-3.3.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-09 06:23:44",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "politikontroller-py"
}