Skip to content

scop/pytekukko

Repository files navigation

pytekukko -- Jätekukko Omakukko API client

Python versions PyPI version CI status

Simple asyncio client for the Jätekukko Omakukko API.

The API of this package is modeled closely after the Omakukko API. Only read operations are implemented (well apart from, strictly speaking, login/logout), and there are no plans to add support for any write ones.

Usage in a nutshell:

  • construct an aiohttp ClientSession,
  • construct a Pytekukko client with it and your credentials,
  • invoke methods on the client.

The Omakukko API uses cookie based sessions, use a persistent aiohttp CookieJar to maintain client session across interpreter restarts.

High level client methods handle logging in when the need to do so is detected. If the detection is successful, there is no need to separately track session expiration or use the login method in the first place.

Command line examples

For usage examples, see utilities in the pytekukko.examples package. Executables and dependencies for these are installed when the package is installed with the examples extra, invoke them with --help for usage and setup information:

  • pytekukko-collection-schedules: output collection schedules in JSON
  • pytekukko-invoice-headers: output basic info on invoices in JSON
  • pytekukko-next-collections: output next collection dates in JSON

Shell completions for the examples can be generated with shtab's CLI usage mode.

shtab \
  --prog pytekukko-collection-schedules \
  --prefix pytekukko_collection_schedules \
  pytekukko.examples.print_collection_schedules.argparser
shtab \
  --prog pytekukko-invoice-headers \
  --prefix pytekukko_invoice_headers \
  pytekukko.examples.print_invoice_headers.argparser
shtab \
  --prog pytekukko-next-collections \
  --prefix pytekukko_next_collections \
  pytekukko.examples.print_next_collections.argparser

Disclaimer

This package is not supported by or endorsed by Jätekukko. Do not bother them with questions or issues related to it.

About

Jätekukko Omakukko API client

Topics

Resources

License

Stars

Watchers

Forks

Contributors 5