Skip to main content

Client library for ActivityWatch

Project description

aw-client

GitHub Actions badge PyPI Code style: black Typechecking: Mypy

Client library for ActivityWatch in Python.

Please see the documentation for usage, and take a look at examples/.

How to install

Install from pip: pip install aw-client

Install the latest version directly from github without cloning: pip install git+https://github.com/ActivityWatch/aw-client.git

To install from a cloned version:

  • clone repo: git clone https://github.com/ActivityWatch/aw-client.git
  • cd into the directory: cd aw-client
  • run poetry install (will create a virtualenv, if none activated)
    • If you don't want to use poetry you can also use pip install ., but that might not get the exact version of the dependencies (due to not reading the poetry.lock file).

Usage

For the CLI:

$ aw-client --help
Usage: aw-client [OPTIONS] COMMAND [ARGS]...

  CLI utility for aw-client to aid in interacting with the ActivityWatch
  server

Options:
  --host TEXT     Address of host
  --port INTEGER  Port to use
  -v, --verbose   Verbosity
  --testing       Set to use testing ports by default
  --help          Show this message and exit.

Commands:
  buckets    List all buckets
  canonical  Query 'canonical events' for a single host (filtered,...
  events     Query events from bucket with ID `bucket_id`
  heartbeat  Send a heartbeat to bucket with ID `bucket_id` with JSON `data`
  query      Run a query in file at `path` on the server
  report     Generate an activity report

Debugging

  • Run python with LOG_LEVEL=debug to get additional debugging output
  • If invalid events have been queued for submission, you may need to delete the file-based queues generated by this library
  • To use the development version of this library use aw-client = {path = "../aw-client" } in pyproject.toml

Examples

The examples/ directory contains a couple of example scripts, including:

  • time_spent_today.py - fetches all non-afk events and sums their duration to get the total active time for the day.
  • merge_buckets.py - merges two buckets with non-intersecting events by moving all events from one into the other.
  • redact_sensitive.py - redact sensitive events.

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

aw-client-0.5.9.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

aw_client-0.5.9-py3-none-any.whl (20.5 kB view details)

Uploaded Python 3

File details

Details for the file aw-client-0.5.9.tar.gz.

File metadata

  • Download URL: aw-client-0.5.9.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.9 Linux/5.15.3-arch1-1

File hashes

Hashes for aw-client-0.5.9.tar.gz
Algorithm Hash digest
SHA256 fd93dc58582492fca316c59aeaa4d24651284ef94c9aed92d94b4afd812a6cfa
MD5 d73c106ff5225346ef9475a56da0bdd8
BLAKE2b-256 521b05b245e6cd98c40ee2b7ee9421d73a027dc6510a5bd5fcafabcd8cd0ed64

See more details on using hashes here.

File details

Details for the file aw_client-0.5.9-py3-none-any.whl.

File metadata

  • Download URL: aw_client-0.5.9-py3-none-any.whl
  • Upload date:
  • Size: 20.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.9.9 Linux/5.15.3-arch1-1

File hashes

Hashes for aw_client-0.5.9-py3-none-any.whl
Algorithm Hash digest
SHA256 1c2449bbaecfb42e029268c67d9eea8cbc4b807e80e59a0389c1b771b43d62de
MD5 95fa29213ef38cc1696e293d9d5024bf
BLAKE2b-256 757cb230a5033a5ea8a77ce01f176c9c501025307e3accbe79e03fccd91ef6a8

See more details on using hashes here.

Supported by

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