Skip to main content

Habiticalib

Modern asynchronous Python client library for the Habitica API

build codecov PyPI version

Habiticalib is a Python library for interacting with the Habitica API. It provides an organized, typed interface to work with Habitica’s features, including tasks, user data, and avatars. The goal of this library is to simplify integration with Habitica.

Key features

  • Asynchronous: The library is fully asynchronous, allowing non-blocking API calls.
  • Fully typed with Dataclasses: The library is fully typed using Python dataclasses. It handles serialization with mashumaro and orjson for efficient conversion between Habitica API JSON data and Python objects.
  • Dynamic avatar image generation: Habiticalib can fetch all necessary assets (like equipped items, pets, and mounts) and combine them into a single avatar image. This image can be saved to disk or returned as a byte buffer for further processing. Fetch user data: Retrieve and manage user data such as stats, preferences, and items. User data is structured with dataclasses to make it easy to work with.
  • Task management: Support for creating, updating, and retrieving Habitica tasks (to-dos, dailies, habits, rewards) is provided.
  • Task status updates: The library allows updates for task statuses, habit scoring, and daily completion.
  • Tags: Habiticalib supports the creation, updating and deletion of tags.
  • Stat allocation, class cystem and sleep: The library offers methods for stat point allocation and switching between Habitica classes. It also provides the ability to disable the class system and pausing damage(resting in the inn)

Installation

pip install habiticalib

Getting started

Here’s an example to demonstrate basic usage:

import asyncio

from aiohttp import ClientSession

from habiticalib import Habitica, TaskType


async def main():
    async with ClientSession() as session:
       habitica = Habitica(session)

       # Login to Habitica
       habitica.login(username="your_username", password="your_password")

       # Fetch user data
       user_data = await habitica.user()
       print(f"Your current health: {user_data.stats.hp}")

        # Fetch all tasks (to-dos, dailies, habits, and rewards)
        tasks = await habitica.get_tasks()
        print("All tasks:")
        for task in tasks:
            print(f"- {task.text} (type: {task.type})")

        # Fetch only to-dos
        todos = await habitica.get_tasks(task_type=TaskType.TODO)
        print("\nTo-Do tasks:")
        for todo in todos:
            print(f"- {todo.text} (due: {todo.date})")

        # Fetch only dailies
        dailies = await habitica.tasks(task_type=TaskType.DAILY)
        print("\nDailies:")
        for daily in dailies:
            print(f"- {daily.text}")

asyncio.run(main())

Documentation

For full documentation and detailed usage examples, please visit the Habiticalib documentation.

License

This project is licensed under the terms of the MIT license.

Metadata

Release files for Habiticalib 0.3.7

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Habiticalib 0.3.7
File Size Uploaded Provenance Actions
habiticalib-0.3.7.tar.gz 117.2 kB Without provenance Details for habiticalib-0.3.7.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for Habiticalib 0.3.7
File Interpreter ABI Platform Actions
habiticalib-0.3.7-py3-none-any.whl Python 3 none any Details for habiticalib-0.3.7-py3-none-any.whl

Total release size: 155.5 kB

Release files / habiticalib-0.3.7.tar.gz

Download URL habiticalib-0.3.7.tar.gz
Size 117.2 kB
Tags Source
SHA-256 checksum
How to use checksums
3da470cf7d5ed6311521c9cbaa87ed72d43b4bd8bd2416993c359237d898b55b
BLAKE2b-256 checksum
How to use checksums
170f3b59acb9e637b7bbb43c338c555193f4210cb8716552eeb08702f4051942
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via python-httpx/0.28.1

Release files / habiticalib-0.3.7-py3-none-any.whl

Download URL habiticalib-0.3.7-py3-none-any.whl
Size 38.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b591cde86a0bbef7d433c329981666fb72c5608b54f0991008491585d0a938e7
BLAKE2b-256 checksum
How to use checksums
45542ee4e287d7d4c4789ccabe2e481a285c5010e1e9acb3cc29a88942f6c099
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via python-httpx/0.28.1

Security for Habiticalib 0.3.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.3.7 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page