Skip to main content

Unofficial client for politikontroller.no

Project description

politikontroller-py

GitHub Release Python Versions Project Maintenance License Made with Love in Norway

Build Status Code coverage

Install

pip install politikontroller-py

Usage

Basic usage

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

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

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

$ 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

politikontroller_py-3.3.2.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

politikontroller_py-3.3.2-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file politikontroller_py-3.3.2.tar.gz.

File metadata

  • Download URL: politikontroller_py-3.3.2.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.0 CPython/3.12.8

File hashes

Hashes for politikontroller_py-3.3.2.tar.gz
Algorithm Hash digest
SHA256 16772bb589519d8d2471b6354eae7ec868e2f53cb4e7cae6b5f763dfb2205206
MD5 813a4f23ce5f9473489b0596e0b0c545
BLAKE2b-256 b730674d51de4e5854383c6ecb14217361ebf5434b71c2c7fd09e6e40b0a5c26

See more details on using hashes here.

File details

Details for the file politikontroller_py-3.3.2-py3-none-any.whl.

File metadata

File hashes

Hashes for politikontroller_py-3.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b7854bf8af1fc017ae7afbd42717d7b1d1eda3edae72e72c88ef8e6d59e987aa
MD5 d4c079e2b50c65c509a6130021146345
BLAKE2b-256 0e59fae04e371a5bacf62dd0f38ab81054f1cfc81a2f4e163d4887a524c7b385

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page