Habiticalib 0.1.0__tar.gz

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.
Files changed (44) hide show
  1. habiticalib-0.1.0/.cruft.json +27 -0
  2. habiticalib-0.1.0/.editorconfig +11 -0
  3. habiticalib-0.1.0/.github/FUNDING.yml +3 -0
  4. habiticalib-0.1.0/.github/dependabot.yml +10 -0
  5. habiticalib-0.1.0/.github/labels.yml +66 -0
  6. habiticalib-0.1.0/.github/release-drafter.yml +94 -0
  7. habiticalib-0.1.0/.github/workflows/build.yml +86 -0
  8. habiticalib-0.1.0/.github/workflows/documentation.yml +56 -0
  9. habiticalib-0.1.0/.github/workflows/draft.yml +19 -0
  10. habiticalib-0.1.0/.github/workflows/labeler.yml +25 -0
  11. habiticalib-0.1.0/.gitignore +113 -0
  12. habiticalib-0.1.0/.pre-commit-config.yaml +34 -0
  13. habiticalib-0.1.0/.vscode/settings.json +22 -0
  14. habiticalib-0.1.0/LICENSE +22 -0
  15. habiticalib-0.1.0/PKG-INFO +97 -0
  16. habiticalib-0.1.0/README.md +79 -0
  17. habiticalib-0.1.0/docs/index.md +1 -0
  18. habiticalib-0.1.0/docs/reference/habiticalib.md +6 -0
  19. habiticalib-0.1.0/mkdocs.yml +67 -0
  20. habiticalib-0.1.0/pyproject.toml +133 -0
  21. habiticalib-0.1.0/src/habiticalib/__init__.py +71 -0
  22. habiticalib-0.1.0/src/habiticalib/const.py +16 -0
  23. habiticalib-0.1.0/src/habiticalib/exceptions.py +50 -0
  24. habiticalib-0.1.0/src/habiticalib/helpers.py +138 -0
  25. habiticalib-0.1.0/src/habiticalib/lib.py +1558 -0
  26. habiticalib-0.1.0/src/habiticalib/py.typed +0 -0
  27. habiticalib-0.1.0/src/habiticalib/types.py +1224 -0
  28. habiticalib-0.1.0/tests/__init__.py +1 -0
  29. habiticalib-0.1.0/tests/__snapshots__/test_avatar.ambr +28 -0
  30. habiticalib-0.1.0/tests/__snapshots__/test_lib.ambr +7 -0
  31. habiticalib-0.1.0/tests/conftest.py +49 -0
  32. habiticalib-0.1.0/tests/fixtures/login.json +10 -0
  33. habiticalib-0.1.0/tests/fixtures/user.json +465 -0
  34. habiticalib-0.1.0/tests/fixtures/user_styles.json +57 -0
  35. habiticalib-0.1.0/tests/fixtures/user_styles_kickstarter.json +57 -0
  36. habiticalib-0.1.0/tests/fixtures/user_styles_seafoam.json +57 -0
  37. habiticalib-0.1.0/tests/fixtures/user_styles_shinySeed.json +57 -0
  38. habiticalib-0.1.0/tests/fixtures/user_styles_sleeping.json +57 -0
  39. habiticalib-0.1.0/tests/fixtures/user_styles_snowball.json +57 -0
  40. habiticalib-0.1.0/tests/fixtures/user_styles_spookySparkles.json +57 -0
  41. habiticalib-0.1.0/tests/fixtures/user_styles_with_chair.json +57 -0
  42. habiticalib-0.1.0/tests/test_avatar.py +100 -0
  43. habiticalib-0.1.0/tests/test_init.py +16 -0
  44. habiticalib-0.1.0/tests/test_lib.py +30 -0
@@ -0,0 +1,27 @@
1
+ {
2
+ "template": "https://github.com/tr4nt0r/cookiecutter-hatch",
3
+ "commit": "8d08540791a735c0668f08b8025719728c7677f9",
4
+ "checkout": null,
5
+ "context": {
6
+ "cookiecutter": {
7
+ "full_name": "Manfred Dennerlein Rodelo",
8
+ "email": "manfred@dennerlein.name",
9
+ "github_username": "tr4nt0r",
10
+ "project_name": "Habiticalib",
11
+ "dist_name": "habiticalib",
12
+ "package_name": "habiticalib",
13
+ "project_short_description": "Modern asynchronous Python client library for the Habitica API",
14
+ "repository_name": "tr4nt0r/habiticalib",
15
+ "repository_url": "https://github.com/tr4nt0r/habiticalib",
16
+ "docs_url": "https://tr4nt0r.github.io/habiticalib/",
17
+ "open_source_license": "MIT license",
18
+ "python_version": "3.12",
19
+ "asyncio": "Y",
20
+ "docs_icon": "material/library",
21
+ "docs_color_primary": "deep purple",
22
+ "docs_color_accent": "purple",
23
+ "_template": "https://github.com/tr4nt0r/cookiecutter-hatch"
24
+ }
25
+ },
26
+ "directory": null
27
+ }
@@ -0,0 +1,11 @@
1
+ # http://editorconfig.org
2
+
3
+ root = true
4
+
5
+ [*]
6
+ indent_style = space
7
+ indent_size = 4
8
+ trim_trailing_whitespace = true
9
+ insert_final_newline = true
10
+ charset = utf-8
11
+ end_of_line = lf
@@ -0,0 +1,3 @@
1
+ github: [tr4nt0r]
2
+ buy_me_a_coffee: tr4nt0r
3
+
@@ -0,0 +1,10 @@
1
+ version: 2
2
+ updates:
3
+ - package-ecosystem: "pip"
4
+ directory: "/"
5
+ schedule:
6
+ interval: "weekly"
7
+ - package-ecosystem: "github-actions"
8
+ directory: "/"
9
+ schedule:
10
+ interval: "weekly"
@@ -0,0 +1,66 @@
1
+ ---
2
+ # Labels names are important as they are used by Release Drafter to decide
3
+ # regarding where to record them in changelog or if to skip them.
4
+ #
5
+ # The repository labels will be automatically configured using this file and
6
+ # the GitHub Action https://github.com/marketplace/actions/github-labeler.
7
+ - name: breaking
8
+ description: Breaking Changes
9
+ color: bfd4f2
10
+ - name: bug
11
+ description: Something isn't working
12
+ color: d73a4a
13
+ - name: build
14
+ description: Build System and Dependencies
15
+ color: bfdadc
16
+ - name: ci
17
+ description: Continuous Integration
18
+ color: 4a97d6
19
+ - name: dependencies
20
+ description: Pull requests that update a dependency file
21
+ color: 0366d6
22
+ - name: documentation
23
+ description: Improvements or additions to documentation
24
+ color: 0075ca
25
+ - name: duplicate
26
+ description: This issue or pull request already exists
27
+ color: cfd3d7
28
+ - name: feature
29
+ description: New feature or request
30
+ color: a2eeef
31
+ - name: github_actions
32
+ description: Pull requests that update Github_actions code
33
+ color: "000000"
34
+ - name: good first issue
35
+ description: Good for newcomers
36
+ color: 7057ff
37
+ - name: help wanted
38
+ description: Extra attention is needed
39
+ color: 008672
40
+ - name: invalid
41
+ description: This doesn't seem right
42
+ color: e4e669
43
+ - name: performance
44
+ description: Performance
45
+ color: "016175"
46
+ - name: python
47
+ description: Pull requests that update Python code
48
+ color: 2b67c6
49
+ - name: question
50
+ description: Further information is requested
51
+ color: d876e3
52
+ - name: code quality
53
+ description: Code quality improvements
54
+ color: ef67c4
55
+ - name: deprecation
56
+ description: Removals and Deprecations
57
+ color: 9ae7ea
58
+ - name: style
59
+ description: Style
60
+ color: c120e5
61
+ - name: testing
62
+ description: Pull request that adds tests
63
+ color: b1fc6f
64
+ - name: wontfix
65
+ description: This will not be worked on
66
+ color: ffffff
@@ -0,0 +1,94 @@
1
+ name-template: '$RESOLVED_VERSION'
2
+ tag-template: 'v$RESOLVED_VERSION'
3
+
4
+
5
+ categories:
6
+ - title: '⚠️ Breaking changes'
7
+ labels:
8
+ - 'breaking'
9
+ - title: '🚀 Features'
10
+ labels:
11
+ - 'feature'
12
+ - 'enhancement'
13
+ - title: '🐛 Bug Fixes'
14
+ labels:
15
+ - 'bug'
16
+ - title: '⏳ Deprecations'
17
+ labels:
18
+ - 'deprecation'
19
+ - title: '📃 Documentation'
20
+ labels:
21
+ - 'documentation'
22
+ - title: '🧩 Dependency Updates'
23
+ labels:
24
+ - 'dependencies'
25
+ - 'github_actions'
26
+ collapse-after: 5
27
+ - title: '🧰 Maintenance'
28
+ labels:
29
+ - 'perfomance'
30
+ - 'refactor'
31
+ - 'ci'
32
+ - 'build'
33
+ - title: '🔬 Other updates'
34
+ labels:
35
+ - 'style'
36
+ - 'testing'
37
+
38
+ autolabeler:
39
+ - label: 'feature'
40
+ title:
41
+ - '/adds/i'
42
+ - label: 'bug'
43
+ title:
44
+ - '/fix/i'
45
+ - label: 'code quality'
46
+ title:
47
+ - '/Refactor/i'
48
+ - label: 'testing'
49
+ title:
50
+ - '/test:/i'
51
+ files:
52
+ - 'test_*'
53
+ - 'conftest.py'
54
+ - label: 'documentation'
55
+ title:
56
+ - '/docs:/i'
57
+ files:
58
+ - '*.md'
59
+ - 'mkdocs.yml'
60
+ - label: 'ci'
61
+ title:
62
+ - '/ci:/i'
63
+ files:
64
+ - '.github/*'
65
+ - label: 'dependencies'
66
+ title:
67
+ - '/bump/i'
68
+ - label: 'deprecation'
69
+ title:
70
+ - '/Deprecate/i'
71
+
72
+ change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
73
+ change-title-escapes: '\<*_&' # You can add # and @ to disable mentions, and add ` to disable code blocks.
74
+ exclude-contributors:
75
+ - 'tr4nt0r'
76
+
77
+ version-resolver:
78
+ major:
79
+ labels:
80
+ - 'major'
81
+ minor:
82
+ labels:
83
+ - 'minor'
84
+ patch:
85
+ labels:
86
+ - 'patch'
87
+ default: patch
88
+
89
+ template: |
90
+ ## Changes
91
+
92
+ $CHANGES
93
+
94
+ Special thanks to: $CONTRIBUTORS
@@ -0,0 +1,86 @@
1
+ name: Build
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ test:
7
+
8
+ runs-on: ubuntu-latest
9
+ strategy:
10
+ matrix:
11
+ python_version: ['3.12']
12
+
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+ - name: Set up Python
16
+ uses: actions/setup-python@v5
17
+ with:
18
+ python-version: ${{ matrix.python_version }}
19
+ - name: Install dependencies
20
+ run: |
21
+ python -m pip install --upgrade pip
22
+ pip install hatch
23
+ hatch env create
24
+ - name: Lint and typecheck
25
+ run: |
26
+ hatch run lint-check
27
+ - name: Test
28
+ run: |
29
+ hatch run test-cov-xml
30
+ - uses: codecov/codecov-action@v5
31
+ with:
32
+ token: ${{ secrets.CODECOV_TOKEN }}
33
+ fail_ci_if_error: true
34
+ verbose: true
35
+
36
+ release:
37
+ runs-on: ubuntu-latest
38
+ environment: release
39
+ needs: test
40
+ if: startsWith(github.ref, 'refs/tags/')
41
+ permissions:
42
+ contents: write
43
+ id-token: write
44
+
45
+ steps:
46
+ - uses: actions/checkout@v4
47
+ - name: Set up Python
48
+ uses: actions/setup-python@v5
49
+ with:
50
+ python-version: '3.12'
51
+ - name: Install dependencies
52
+ shell: bash
53
+ run: |
54
+ python -m pip install --upgrade pip
55
+ pip install hatch
56
+ - name: mint API token
57
+ id: mint-token
58
+ run: |
59
+ # retrieve the ambient OIDC token
60
+ resp=$(curl -H "Authorization: bearer $ACTIONS_ID_TOKEN_REQUEST_TOKEN" \
61
+ "$ACTIONS_ID_TOKEN_REQUEST_URL&audience=pypi")
62
+ oidc_token=$(jq -r '.value' <<< "${resp}")
63
+
64
+ # exchange the OIDC token for an API token
65
+ resp=$(curl -X POST https://pypi.org/_/oidc/mint-token -d "{\"token\": \"${oidc_token}\"}")
66
+ api_token=$(jq -r '.token' <<< "${resp}")
67
+
68
+ # mask the newly minted API token, so that we don't accidentally leak it
69
+ echo "::add-mask::${api_token}"
70
+
71
+ # see the next step in the workflow for an example of using this step output
72
+ echo "api-token=${api_token}" >> "${GITHUB_OUTPUT}"
73
+ - name: Build and publish on PyPI
74
+ env:
75
+ HATCH_INDEX_USER: __token__
76
+ HATCH_INDEX_AUTH: ${{ steps.mint-token.outputs.api-token }}
77
+ run: |
78
+ hatch build
79
+ hatch publish
80
+ - name: Create release
81
+ uses: ncipollo/release-action@v1
82
+ with:
83
+ draft: true
84
+ body: ${{ github.event.head_commit.message }}
85
+ artifacts: dist/*.whl,dist/*.tar.gz
86
+ token: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,56 @@
1
+ name: Build documentation
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9
+ permissions:
10
+ contents: read
11
+ pages: write
12
+ id-token: write
13
+
14
+ # Allow one concurrent deployment
15
+ concurrency:
16
+ group: "pages"
17
+ cancel-in-progress: true
18
+
19
+ # Default to bash
20
+ defaults:
21
+ run:
22
+ shell: bash
23
+
24
+ jobs:
25
+ build:
26
+
27
+ runs-on: ubuntu-latest
28
+
29
+ steps:
30
+ - uses: actions/checkout@v4
31
+ - name: Set up Python
32
+ uses: actions/setup-python@v5
33
+ with:
34
+ python-version: '3.12'
35
+ - name: Install dependencies
36
+ run: |
37
+ python -m pip install --upgrade pip
38
+ pip install hatch
39
+ hatch env create
40
+ - name: Build
41
+ run: hatch run docs-build
42
+ - name: Upload artifact
43
+ uses: actions/upload-pages-artifact@v3
44
+ with:
45
+ path: ./site
46
+
47
+ deploy:
48
+ environment:
49
+ name: github-pages
50
+ url: ${{ steps.deployment.outputs.page_url }}
51
+ runs-on: ubuntu-latest
52
+ needs: build
53
+ steps:
54
+ - name: Deploy to GitHub Pages
55
+ id: deployment
56
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,19 @@
1
+ name: Release Drafter
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+
8
+ jobs:
9
+ update-draft:
10
+ runs-on: ubuntu-latest
11
+ permissions:
12
+ contents: write
13
+ steps:
14
+ # Drafts your next Release notes as Pull Requests are merged into "main"
15
+ - uses: release-drafter/release-drafter@v6
16
+ with:
17
+ disable-autolabeler: true
18
+ env:
19
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -0,0 +1,25 @@
1
+ name: Labeler
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ - master
8
+
9
+ permissions:
10
+ actions: read
11
+ contents: read
12
+ security-events: write
13
+ pull-requests: write
14
+
15
+ jobs:
16
+ labeler:
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: Check out the repository
20
+ uses: actions/checkout@v4
21
+
22
+ - name: Run Labeler
23
+ uses: crazy-max/ghaction-github-labeler@v5.0.0
24
+ with:
25
+ skip-delete: true
@@ -0,0 +1,113 @@
1
+ # Byte-compiled / optimized / DLL files
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+
6
+ # C extensions
7
+ *.so
8
+
9
+ # Distribution / packaging
10
+ .Python
11
+ env/
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ wheels/
24
+ *.egg-info/
25
+ .installed.cfg
26
+ *.egg
27
+
28
+ # PyInstaller
29
+ # Usually these files are written by a python script from a template
30
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
31
+ *.manifest
32
+ *.spec
33
+
34
+ # Installer logs
35
+ pip-log.txt
36
+ pip-delete-this-directory.txt
37
+
38
+ # Unit test / coverage reports
39
+ htmlcov/
40
+ .tox/
41
+ .coverage
42
+ .coverage.*
43
+ .cache
44
+ nosetests.xml
45
+ coverage.xml
46
+ *.cover
47
+ .hypothesis/
48
+ .pytest_cache/
49
+ junit/
50
+ junit.xml
51
+ test.db
52
+
53
+ # Translations
54
+ *.mo
55
+ *.pot
56
+
57
+ # Django stuff:
58
+ *.log
59
+ local_settings.py
60
+
61
+ # Flask stuff:
62
+ instance/
63
+ .webassets-cache
64
+
65
+ # Scrapy stuff:
66
+ .scrapy
67
+
68
+ # Sphinx documentation
69
+ docs/_build/
70
+
71
+ # PyBuilder
72
+ target/
73
+
74
+ # Jupyter Notebook
75
+ .ipynb_checkpoints
76
+ *.ipynb
77
+
78
+ # pyenv
79
+ .python-version
80
+
81
+ # celery beat schedule file
82
+ celerybeat-schedule
83
+
84
+ # SageMath parsed files
85
+ *.sage.py
86
+
87
+ # dotenv
88
+ .env
89
+
90
+ # virtualenv
91
+ .venv
92
+ venv/
93
+ ENV/
94
+
95
+ # Spyder project settings
96
+ .spyderproject
97
+ .spyproject
98
+
99
+ # Rope project settings
100
+ .ropeproject
101
+
102
+ # mkdocs documentation
103
+ /site
104
+
105
+ # mypy
106
+ .mypy_cache/
107
+
108
+ # OS files
109
+ .DS_Store
110
+
111
+
112
+ # Avatar test image
113
+ avatar.png
@@ -0,0 +1,34 @@
1
+ repos:
2
+ - repo: https://github.com/pre-commit/pre-commit-hooks
3
+ rev: v5.0.0
4
+ hooks:
5
+ - id: trailing-whitespace
6
+ - id: check-added-large-files
7
+ - id: check-merge-conflict
8
+ - id: check-shebang-scripts-are-executable
9
+ - id: check-docstring-first
10
+ - id: debug-statements
11
+ - id: check-ast
12
+ - id: check-json
13
+ - id: check-toml
14
+ - id: check-xml
15
+ - id: check-yaml
16
+ args: ['--unsafe'] # needed for !! tags in mkdocs.yml
17
+ - id: end-of-file-fixer
18
+ - id: mixed-line-ending
19
+ args: ['--fix=auto'] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows
20
+
21
+ # Ruff replaces black, flake8, autoflake, isort and more
22
+ - repo: https://github.com/charliermarsh/ruff-pre-commit
23
+ rev: 'v0.7.0' # make sure this is always consistent with hatch configs
24
+ hooks:
25
+ - id: ruff
26
+ - id: ruff-format
27
+ args: [--check, --config, ./pyproject.toml]
28
+
29
+ - repo: https://github.com/pre-commit/mirrors-mypy
30
+ rev: 'v1.12.0' # make sure this is always consistent with hatch configs
31
+ hooks:
32
+ - id: mypy
33
+ args: ["--install-types", "--non-interactive", "--ignore-missing-imports"]
34
+ additional_dependencies: [types-tabulate, types-cachetools]
@@ -0,0 +1,22 @@
1
+ {
2
+ "python.analysis.typeCheckingMode": "basic",
3
+ "python.analysis.autoImportCompletions": true,
4
+ "python.terminal.activateEnvironment": true,
5
+ "python.terminal.activateEnvInCurrentTerminal": true,
6
+ "python.testing.unittestEnabled": false,
7
+ "python.testing.pytestEnabled": true,
8
+ "editor.rulers": [88],
9
+ "python.defaultInterpreterPath": "${workspaceFolder}/.hatch/habitica/bin/python",
10
+ "python.testing.pytestPath": "${workspaceFolder}/.hatch/habitica/bin/pytest",
11
+ "python.testing.cwd": "${workspaceFolder}",
12
+ "python.testing.pytestArgs": ["--no-cov"],
13
+ "[python]": {
14
+ "editor.formatOnSave": true,
15
+ "editor.codeActionsOnSave": {
16
+ "source.fixAll": "explicit",
17
+ "source.organizeImports": "explicit"
18
+ },
19
+ "editor.defaultFormatter": "charliermarsh.ruff"
20
+ },
21
+ "pylint.enabled": false
22
+ }
@@ -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
+
@@ -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
+ [![build](https://github.com/tr4nt0r/habiticalib/workflows/Build/badge.svg)](https://github.com/tr4nt0r/habiticalib/actions)
26
+ [![codecov](https://codecov.io/gh/tr4nt0r/habiticalib/graph/badge.svg?token=iEsZ1Ktj7d)](https://codecov.io/gh/tr4nt0r/habiticalib)
27
+ [![PyPI version](https://badge.fury.io/py/habiticalib.svg)](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.