Habiticalib 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- habiticalib/__init__.py +71 -0
- habiticalib/const.py +16 -0
- habiticalib/exceptions.py +50 -0
- habiticalib/helpers.py +138 -0
- habiticalib/lib.py +1558 -0
- habiticalib/py.typed +0 -0
- habiticalib/types.py +1224 -0
- habiticalib-0.1.0.dist-info/METADATA +97 -0
- habiticalib-0.1.0.dist-info/RECORD +11 -0
- habiticalib-0.1.0.dist-info/WHEEL +4 -0
- habiticalib-0.1.0.dist-info/licenses/LICENSE +22 -0
@@ -0,0 +1,97 @@
|
|
1
|
+
Metadata-Version: 2.3
|
2
|
+
Name: Habiticalib
|
3
|
+
Version: 0.1.0
|
4
|
+
Summary: Asynchronous Python client library for the Habitica API
|
5
|
+
Project-URL: Documentation, https://tr4nt0r.github.io/habiticalib/
|
6
|
+
Project-URL: Source, https://github.com/tr4nt0r/habiticalib
|
7
|
+
Author-email: Manfred Dennerlein Rodelo <manfred@dennerlein.name>
|
8
|
+
License: MIT License
|
9
|
+
Classifier: License :: OSI Approved :: MIT License
|
10
|
+
Classifier: Operating System :: OS Independent
|
11
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
12
|
+
Requires-Python: >=3.12
|
13
|
+
Requires-Dist: aiohttp~=3.9
|
14
|
+
Requires-Dist: mashumaro~=3.13
|
15
|
+
Requires-Dist: orjson~=3.10
|
16
|
+
Requires-Dist: pillow~=11.0
|
17
|
+
Description-Content-Type: text/markdown
|
18
|
+
|
19
|
+
# Habiticalib
|
20
|
+
|
21
|
+
<p align="center">
|
22
|
+
<em>Modern asynchronous Python client library for the Habitica API</em>
|
23
|
+
</p>
|
24
|
+
|
25
|
+
[](https://github.com/tr4nt0r/habiticalib/actions)
|
26
|
+
[](https://codecov.io/gh/tr4nt0r/habiticalib)
|
27
|
+
[](https://badge.fury.io/py/habiticalib)
|
28
|
+
|
29
|
+
**Habiticalib** is a Python library for interacting with the [Habitica API](https://habitica.com). 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.
|
30
|
+
|
31
|
+
## Key features
|
32
|
+
|
33
|
+
- **Asynchronous**: The library is fully asynchronous, allowing non-blocking API calls.
|
34
|
+
- **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.
|
35
|
+
- **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.
|
36
|
+
**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.
|
37
|
+
- **Task management**: Support for creating, updating, and retrieving Habitica tasks (to-dos, dailies, habits, rewards) is provided.
|
38
|
+
- **Task status updates**: The library allows updates for task statuses, habit scoring, and daily completion.
|
39
|
+
- **Tags**: Habiticalib supports the creation, updating and deletion of tags.
|
40
|
+
- **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)
|
41
|
+
|
42
|
+
## Installation
|
43
|
+
|
44
|
+
```bash
|
45
|
+
pip install habiticalib
|
46
|
+
```
|
47
|
+
|
48
|
+
## Getting started
|
49
|
+
Here’s an example to demonstrate basic usage:
|
50
|
+
|
51
|
+
```python
|
52
|
+
import asyncio
|
53
|
+
|
54
|
+
from aiohttp import ClientSession
|
55
|
+
|
56
|
+
from habiticalib import Habitica, TaskType
|
57
|
+
|
58
|
+
|
59
|
+
async def main():
|
60
|
+
async with ClientSession() as session:
|
61
|
+
habitica = Habitica(session)
|
62
|
+
|
63
|
+
# Login to Habitica
|
64
|
+
habitica.login(username="your_username", password="your_password")
|
65
|
+
|
66
|
+
# Fetch user data
|
67
|
+
user_data = await habitica.user()
|
68
|
+
print(f"Your current health: {user_data.stats.hp}")
|
69
|
+
|
70
|
+
# Fetch all tasks (to-dos, dailies, habits, and rewards)
|
71
|
+
tasks = await habitica.get_tasks()
|
72
|
+
print("All tasks:")
|
73
|
+
for task in tasks:
|
74
|
+
print(f"- {task.text} (type: {task.type})")
|
75
|
+
|
76
|
+
# Fetch only to-dos
|
77
|
+
todos = await habitica.get_tasks(task_type=TaskType.TODO)
|
78
|
+
print("\nTo-Do tasks:")
|
79
|
+
for todo in todos:
|
80
|
+
print(f"- {todo.text} (due: {todo.date})")
|
81
|
+
|
82
|
+
# Fetch only dailies
|
83
|
+
dailies = await habitica.tasks(task_type=TaskType.DAILY)
|
84
|
+
print("\nDailies:")
|
85
|
+
for daily in dailies:
|
86
|
+
print(f"- {daily.text}")
|
87
|
+
|
88
|
+
asyncio.run(main())
|
89
|
+
```
|
90
|
+
|
91
|
+
## Documentation
|
92
|
+
|
93
|
+
For full documentation and detailed usage examples, please visit the [Habiticalib documentation](https://tr4nt0r.github.io/habiticalib/).
|
94
|
+
|
95
|
+
## License
|
96
|
+
|
97
|
+
This project is licensed under the terms of the MIT license.
|
@@ -0,0 +1,11 @@
|
|
1
|
+
habiticalib/__init__.py,sha256=rwRSTk3JFaSnVKRniTC82tA5JKPSuQ-AD_mAok2QU_g,1561
|
2
|
+
habiticalib/const.py,sha256=OafUalLtmoZePZ8e0ERl9eB0_LQmENsrDARU86GVAjY,607
|
3
|
+
habiticalib/exceptions.py,sha256=oVFCGbHkVn0UpIKIPZPzXfvzs9US4R05ebdEn6cOpqM,1350
|
4
|
+
habiticalib/helpers.py,sha256=IRZLYWkDVLI0iVBgBMmvZ6L83KCUl-CnzGhUR_tP6Fg,4576
|
5
|
+
habiticalib/lib.py,sha256=MMs3BINdbZUszUy_DCWvFWDZKy2or1UA5R47X3GeUwI,54274
|
6
|
+
habiticalib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
habiticalib/types.py,sha256=7xpxpvpDQBxsyuD241vQxeXjk6zuEC4yXzw-Of7G7Bw,33187
|
8
|
+
habiticalib-0.1.0.dist-info/METADATA,sha256=niaG5X8XNWMjMysoLoPzXOJLZfNmjoQNZN7TL9AOYN4,4154
|
9
|
+
habiticalib-0.1.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
10
|
+
habiticalib-0.1.0.dist-info/licenses/LICENSE,sha256=oIinIOSJ49l1iVIRI3XGXFWt6SF7a83kEFBAY8ORwNI,1084
|
11
|
+
habiticalib-0.1.0.dist-info/RECORD,,
|
@@ -0,0 +1,22 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024, Manfred Dennerlein Rodelo
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|