Habiticalib 0.3.5__tar.gz → 0.3.7rc0__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.
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/.github/release-drafter.yml +7 -7
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/.github/workflows/draft.yml +1 -1
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/.github/workflows/labeler.yml +2 -6
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/PKG-INFO +1 -1
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/pyproject.toml +2 -2
- habiticalib-0.3.7rc0/src/habiticalib/__init__.py +320 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/src/habiticalib/const.py +1 -1
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/src/habiticalib/exceptions.py +1 -1
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/src/habiticalib/helpers.py +5 -5
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/src/habiticalib/lib.py +20 -18
- habiticalib-0.3.5/src/habiticalib/types.py → habiticalib-0.3.7rc0/src/habiticalib/typedefs.py +279 -247
- habiticalib-0.3.7rc0/tests/__snapshots__/test_avatar.ambr +4 -0
- habiticalib-0.3.7rc0/tests/__snapshots__/test_serialize.ambr +4021 -0
- habiticalib-0.3.7rc0/tests/__snapshots__/test_user.ambr +7 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/user.json +39 -1
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/test_avatar.py +7 -8
- habiticalib-0.3.7rc0/tests/test_serialize.py +38 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/test_tasks.py +11 -2
- habiticalib-0.3.5/src/habiticalib/__init__.py +0 -109
- habiticalib-0.3.5/tests/__snapshots__/test_avatar.ambr +0 -4
- habiticalib-0.3.5/tests/__snapshots__/test_user.ambr +0 -7
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/.cruft.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/.editorconfig +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/.github/FUNDING.yml +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/.github/dependabot.yml +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/.github/labels.yml +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/.github/workflows/build.yml +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/.github/workflows/documentation.yml +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/.gitignore +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/.pre-commit-config.yaml +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/.vscode/settings.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/LICENSE +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/README.md +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/docs/index.md +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/docs/reference/habiticalib.md +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/mkdocs.yml +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/src/habiticalib/ha.py +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/src/habiticalib/py.typed +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__init__.py +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_avatar/test_generate_avatar.png +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[animated_background].png +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[default].png +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[kickstarter_backer_gear].png +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[kickstarter_pet_mount].png +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[seafoam].png +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[shinySeed].png +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[sleeping].png +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[snowball].png +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[special_0].png +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[special_1].png +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[spookySparkles].png +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[weapon_critical].png +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_avatar/test_generate_avatar_from_styles[with_chair].png +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_avatar/test_generate_avatar_to_file.png +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_login.ambr +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/__snapshots__/test_tasks.ambr +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/conftest.py +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/empty_data.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/login.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/task.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/task_order.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/tasks.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/user_anonymized.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/user_styles.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/user_styles_animated_background.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/user_styles_kickstarter.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/user_styles_kickstarter_pets.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/user_styles_seafoam.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/user_styles_shinySeed.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/user_styles_sleeping.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/user_styles_snowball.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/user_styles_special_0.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/user_styles_special_1.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/user_styles_spookySparkles.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/user_styles_weapon_critical.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/fixtures/user_styles_with_chair.json +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/test_login.py +0 -0
- {habiticalib-0.3.5 → habiticalib-0.3.7rc0}/tests/test_user.py +0 -0
@@ -19,21 +19,21 @@ categories:
|
|
19
19
|
- title: '📃 Documentation'
|
20
20
|
labels:
|
21
21
|
- 'documentation'
|
22
|
-
- title: '🧩 Dependency Updates'
|
23
|
-
labels:
|
24
|
-
- 'dependencies'
|
25
|
-
- 'github_actions'
|
26
22
|
collapse-after: 5
|
27
23
|
- title: '🧰 Maintenance'
|
28
24
|
labels:
|
29
|
-
- 'perfomance'
|
30
|
-
- 'refactor'
|
31
25
|
- 'ci'
|
32
26
|
- 'build'
|
33
|
-
- title: '🔬 Other
|
27
|
+
- title: '🔬 Other improvements'
|
34
28
|
labels:
|
35
29
|
- 'style'
|
36
30
|
- 'testing'
|
31
|
+
- 'perfomance'
|
32
|
+
- 'code quality'
|
33
|
+
- title: '🧩 Dependency Updates'
|
34
|
+
labels:
|
35
|
+
- 'dependencies'
|
36
|
+
- 'github_actions'
|
37
37
|
|
38
38
|
autolabeler:
|
39
39
|
- label: 'feature'
|
@@ -1,10 +1,6 @@
|
|
1
1
|
name: Labeler
|
2
2
|
|
3
|
-
on:
|
4
|
-
push:
|
5
|
-
branches:
|
6
|
-
- main
|
7
|
-
- master
|
3
|
+
on: workflow_dispatch
|
8
4
|
|
9
5
|
permissions:
|
10
6
|
actions: read
|
@@ -20,6 +16,6 @@ jobs:
|
|
20
16
|
uses: actions/checkout@v4
|
21
17
|
|
22
18
|
- name: Run Labeler
|
23
|
-
uses: crazy-max/ghaction-github-labeler@v5.
|
19
|
+
uses: crazy-max/ghaction-github-labeler@v5.2.0
|
24
20
|
with:
|
25
21
|
skip-delete: true
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: Habiticalib
|
3
|
-
Version: 0.3.
|
3
|
+
Version: 0.3.7rc0
|
4
4
|
Summary: Asynchronous Python client library for the Habitica API
|
5
5
|
Project-URL: Documentation, https://tr4nt0r.github.io/habiticalib/
|
6
6
|
Project-URL: Source, https://github.com/tr4nt0r/habiticalib
|
@@ -4,7 +4,7 @@ line-length = 88
|
|
4
4
|
|
5
5
|
[tool.ruff.lint]
|
6
6
|
select = ["ALL"]
|
7
|
-
ignore = ["TRY003", "D202", "D213", "D417", "ANN003", "ANN401", "E501", "COM812", "ISC001"
|
7
|
+
ignore = ["TRY003", "D202", "D213", "D417", "ANN003", "ANN401", "E501", "COM812", "ISC001"]
|
8
8
|
|
9
9
|
[tool.ruff.lint.isort]
|
10
10
|
force-sort-within-sections = true
|
@@ -24,7 +24,7 @@ indent-style = "space"
|
|
24
24
|
max-complexity = 25
|
25
25
|
|
26
26
|
[tool.ruff.lint.per-file-ignores]
|
27
|
-
"
|
27
|
+
"typedefs.py" = ["N815", "TC003"]
|
28
28
|
"tests/*" = ["SLF001", "S101", "ARG001"]
|
29
29
|
|
30
30
|
[tool.pytest.ini_options]
|
@@ -0,0 +1,320 @@
|
|
1
|
+
"""Modern asynchronous Python client library for the Habitica API."""
|
2
|
+
|
3
|
+
from .const import ASSETS_URL, DEFAULT_URL, __version__
|
4
|
+
from .exceptions import (
|
5
|
+
BadRequestError,
|
6
|
+
HabiticaException,
|
7
|
+
NotAuthorizedError,
|
8
|
+
NotFoundError,
|
9
|
+
TooManyRequestsError,
|
10
|
+
)
|
11
|
+
from .helpers import deserialize_task, extract_avatar
|
12
|
+
from .lib import Habitica
|
13
|
+
from .typedefs import (
|
14
|
+
AchievementsUser,
|
15
|
+
AchievmentContent,
|
16
|
+
ActiveFilterTask,
|
17
|
+
AnimalColorAchievementContent,
|
18
|
+
AnimalSetAchievementContent,
|
19
|
+
Attributes,
|
20
|
+
AuthUser,
|
21
|
+
Avatar,
|
22
|
+
BackerUser,
|
23
|
+
BuffsStats,
|
24
|
+
BuffsStatsavatar,
|
25
|
+
CardTypes,
|
26
|
+
Challenge,
|
27
|
+
ChallengeAbortedReason,
|
28
|
+
ChangeClassData,
|
29
|
+
Checklist,
|
30
|
+
CommonTutorial,
|
31
|
+
CompletedBy,
|
32
|
+
ConsecutivePlan,
|
33
|
+
ContentData,
|
34
|
+
ContributorUser,
|
35
|
+
Direction,
|
36
|
+
DropTmpScore,
|
37
|
+
EggEntry,
|
38
|
+
EmailNotificationsPreferences,
|
39
|
+
EntryHistory,
|
40
|
+
EquippedGear,
|
41
|
+
FlagsUser,
|
42
|
+
Frequency,
|
43
|
+
GearClass,
|
44
|
+
GearContent,
|
45
|
+
GearEntry,
|
46
|
+
GearItems,
|
47
|
+
GearItemsAvatar,
|
48
|
+
GearType,
|
49
|
+
GroupTask,
|
50
|
+
HabiticaCastSkillResponse,
|
51
|
+
HabiticaClass,
|
52
|
+
HabiticaClassSystemResponse,
|
53
|
+
HabiticaContentResponse,
|
54
|
+
HabiticaErrorResponse,
|
55
|
+
HabiticaGroupMembersResponse,
|
56
|
+
HabiticaLoginResponse,
|
57
|
+
HabiticaQuestResponse,
|
58
|
+
HabiticaResponse,
|
59
|
+
HabiticaScoreResponse,
|
60
|
+
HabiticaSleepResponse,
|
61
|
+
HabiticaStatsResponse,
|
62
|
+
HabiticaTagResponse,
|
63
|
+
HabiticaTagsResponse,
|
64
|
+
HabiticaTaskOrderResponse,
|
65
|
+
HabiticaTaskResponse,
|
66
|
+
HabiticaTasksResponse,
|
67
|
+
HabiticaUserAnonymizedResponse,
|
68
|
+
HabiticaUserExport,
|
69
|
+
HabiticaUserResponse,
|
70
|
+
HairPreferences,
|
71
|
+
HatchingPotionEntry,
|
72
|
+
HistoryUser,
|
73
|
+
InboxUser,
|
74
|
+
InventoryItemEntry,
|
75
|
+
InvitationsUser,
|
76
|
+
IosTutorial,
|
77
|
+
ItemListContent,
|
78
|
+
ItemListEntry,
|
79
|
+
ItemsAvatar,
|
80
|
+
ItemsUser,
|
81
|
+
Language,
|
82
|
+
LastDropItems,
|
83
|
+
LocalAuth,
|
84
|
+
LocalTimestamps,
|
85
|
+
LoginData,
|
86
|
+
NotificationsUser,
|
87
|
+
PartyMember,
|
88
|
+
PartyUser,
|
89
|
+
PermissionsUser,
|
90
|
+
PetEntry,
|
91
|
+
PetSetCompleteAchievsContent,
|
92
|
+
PinnedItemsUser,
|
93
|
+
PlanPurchased,
|
94
|
+
PreferencesAvatar,
|
95
|
+
PreferencesUser,
|
96
|
+
ProfileUser,
|
97
|
+
ProgressQuest,
|
98
|
+
PurchasedUser,
|
99
|
+
PushDevicesUser,
|
100
|
+
PushNotificationsPreferences,
|
101
|
+
QuestBoss,
|
102
|
+
QuestBossRage,
|
103
|
+
QuestCollect,
|
104
|
+
QuestData,
|
105
|
+
QuestDrop,
|
106
|
+
QuestItem,
|
107
|
+
QuestParty,
|
108
|
+
QuestsAchievments,
|
109
|
+
QuestsContent,
|
110
|
+
QuestTmpScore,
|
111
|
+
QuestUnlockCondition,
|
112
|
+
Reminders,
|
113
|
+
Repeat,
|
114
|
+
ScoreData,
|
115
|
+
Skill,
|
116
|
+
SpecialItemEntry,
|
117
|
+
SpecialItems,
|
118
|
+
SpellEntry,
|
119
|
+
SpellsClass,
|
120
|
+
StableAchievementContent,
|
121
|
+
StatsAvatar,
|
122
|
+
StatsUser,
|
123
|
+
SuppressModalsPreferences,
|
124
|
+
TagsUser,
|
125
|
+
Task,
|
126
|
+
TaskData,
|
127
|
+
TaskFilter,
|
128
|
+
TaskPriority,
|
129
|
+
TasksOrderUser,
|
130
|
+
TasksPreferences,
|
131
|
+
TasksUserExport,
|
132
|
+
TaskType,
|
133
|
+
TmpScore,
|
134
|
+
TourFlags,
|
135
|
+
TrainingStats,
|
136
|
+
TutorialFlags,
|
137
|
+
UltimateGearSetsAchievments,
|
138
|
+
UserAnonymizedData,
|
139
|
+
UserData,
|
140
|
+
UserTasks,
|
141
|
+
WebhooksOptions,
|
142
|
+
WebhooksType,
|
143
|
+
WebhooksUser,
|
144
|
+
)
|
145
|
+
|
146
|
+
__all__ = [
|
147
|
+
"ASSETS_URL",
|
148
|
+
"DEFAULT_URL",
|
149
|
+
"AchievementsUser",
|
150
|
+
"AchievmentContent",
|
151
|
+
"ActiveFilterTask",
|
152
|
+
"AnimalColorAchievementContent",
|
153
|
+
"AnimalSetAchievementContent",
|
154
|
+
"Attributes",
|
155
|
+
"AuthUser",
|
156
|
+
"Avatar",
|
157
|
+
"BackerUser",
|
158
|
+
"BadRequestError",
|
159
|
+
"BuffsStats",
|
160
|
+
"BuffsStatsavatar",
|
161
|
+
"CardTypes",
|
162
|
+
"Challenge",
|
163
|
+
"ChallengeAbortedReason",
|
164
|
+
"ChangeClassData",
|
165
|
+
"ChangeClassData",
|
166
|
+
"Checklist",
|
167
|
+
"Checklist",
|
168
|
+
"CommonTutorial",
|
169
|
+
"CompletedBy",
|
170
|
+
"ConsecutivePlan",
|
171
|
+
"ContentData",
|
172
|
+
"ContentData",
|
173
|
+
"ContributorUser",
|
174
|
+
"Direction",
|
175
|
+
"DropTmpScore",
|
176
|
+
"EggEntry",
|
177
|
+
"EmailNotificationsPreferences",
|
178
|
+
"EntryHistory",
|
179
|
+
"EquippedGear",
|
180
|
+
"FlagsUser",
|
181
|
+
"Frequency",
|
182
|
+
"GearClass",
|
183
|
+
"GearContent",
|
184
|
+
"GearEntry",
|
185
|
+
"GearItems",
|
186
|
+
"GearItemsAvatar",
|
187
|
+
"GearType",
|
188
|
+
"GroupTask",
|
189
|
+
"Habitica",
|
190
|
+
"HabiticaCastSkillResponse",
|
191
|
+
"HabiticaCastSkillResponse",
|
192
|
+
"HabiticaClass",
|
193
|
+
"HabiticaClassSystemResponse",
|
194
|
+
"HabiticaClassSystemResponse",
|
195
|
+
"HabiticaContentResponse",
|
196
|
+
"HabiticaContentResponse",
|
197
|
+
"HabiticaErrorResponse",
|
198
|
+
"HabiticaErrorResponse",
|
199
|
+
"HabiticaException",
|
200
|
+
"HabiticaGroupMembersResponse",
|
201
|
+
"HabiticaGroupMembersResponse",
|
202
|
+
"HabiticaLoginResponse",
|
203
|
+
"HabiticaLoginResponse",
|
204
|
+
"HabiticaQuestResponse",
|
205
|
+
"HabiticaQuestResponse",
|
206
|
+
"HabiticaResponse",
|
207
|
+
"HabiticaResponse",
|
208
|
+
"HabiticaScoreResponse",
|
209
|
+
"HabiticaScoreResponse",
|
210
|
+
"HabiticaSleepResponse",
|
211
|
+
"HabiticaSleepResponse",
|
212
|
+
"HabiticaStatsResponse",
|
213
|
+
"HabiticaStatsResponse",
|
214
|
+
"HabiticaTagResponse",
|
215
|
+
"HabiticaTagResponse",
|
216
|
+
"HabiticaTagsResponse",
|
217
|
+
"HabiticaTagsResponse",
|
218
|
+
"HabiticaTaskOrderResponse",
|
219
|
+
"HabiticaTaskOrderResponse",
|
220
|
+
"HabiticaTaskResponse",
|
221
|
+
"HabiticaTaskResponse",
|
222
|
+
"HabiticaTasksResponse",
|
223
|
+
"HabiticaTasksResponse",
|
224
|
+
"HabiticaUserAnonymizedResponse",
|
225
|
+
"HabiticaUserAnonymizedResponse",
|
226
|
+
"HabiticaUserExport",
|
227
|
+
"HabiticaUserExport",
|
228
|
+
"HabiticaUserResponse",
|
229
|
+
"HabiticaUserResponse",
|
230
|
+
"HairPreferences",
|
231
|
+
"HatchingPotionEntry",
|
232
|
+
"HistoryUser",
|
233
|
+
"InboxUser",
|
234
|
+
"InventoryItemEntry",
|
235
|
+
"InvitationsUser",
|
236
|
+
"IosTutorial",
|
237
|
+
"ItemListContent",
|
238
|
+
"ItemListEntry",
|
239
|
+
"ItemsAvatar",
|
240
|
+
"ItemsUser",
|
241
|
+
"Language",
|
242
|
+
"LastDropItems",
|
243
|
+
"LocalAuth",
|
244
|
+
"LocalTimestamps",
|
245
|
+
"LoginData",
|
246
|
+
"LoginData",
|
247
|
+
"NotAuthorizedError",
|
248
|
+
"NotFoundError",
|
249
|
+
"NotificationsUser",
|
250
|
+
"PartyMember",
|
251
|
+
"PartyUser",
|
252
|
+
"PermissionsUser",
|
253
|
+
"PetEntry",
|
254
|
+
"PetSetCompleteAchievsContent",
|
255
|
+
"PinnedItemsUser",
|
256
|
+
"PlanPurchased",
|
257
|
+
"PreferencesAvatar",
|
258
|
+
"PreferencesUser",
|
259
|
+
"ProfileUser",
|
260
|
+
"ProgressQuest",
|
261
|
+
"PurchasedUser",
|
262
|
+
"PushDevicesUser",
|
263
|
+
"PushNotificationsPreferences",
|
264
|
+
"QuestBoss",
|
265
|
+
"QuestBossRage",
|
266
|
+
"QuestCollect",
|
267
|
+
"QuestData",
|
268
|
+
"QuestData",
|
269
|
+
"QuestDrop",
|
270
|
+
"QuestItem",
|
271
|
+
"QuestParty",
|
272
|
+
"QuestTmpScore",
|
273
|
+
"QuestUnlockCondition",
|
274
|
+
"QuestsAchievments",
|
275
|
+
"QuestsContent",
|
276
|
+
"Reminders",
|
277
|
+
"Repeat",
|
278
|
+
"Repeat",
|
279
|
+
"ScoreData",
|
280
|
+
"ScoreData",
|
281
|
+
"Skill",
|
282
|
+
"SpecialItemEntry",
|
283
|
+
"SpecialItems",
|
284
|
+
"SpellEntry",
|
285
|
+
"SpellsClass",
|
286
|
+
"StableAchievementContent",
|
287
|
+
"StatsAvatar",
|
288
|
+
"StatsUser",
|
289
|
+
"StatsUser",
|
290
|
+
"SuppressModalsPreferences",
|
291
|
+
"TagsUser",
|
292
|
+
"TagsUser",
|
293
|
+
"Task",
|
294
|
+
"TaskData",
|
295
|
+
"TaskData",
|
296
|
+
"TaskFilter",
|
297
|
+
"TaskPriority",
|
298
|
+
"TaskType",
|
299
|
+
"TasksOrderUser",
|
300
|
+
"TasksPreferences",
|
301
|
+
"TasksUserExport",
|
302
|
+
"TmpScore",
|
303
|
+
"TooManyRequestsError",
|
304
|
+
"TourFlags",
|
305
|
+
"TrainingStats",
|
306
|
+
"TutorialFlags",
|
307
|
+
"UltimateGearSetsAchievments",
|
308
|
+
"UserAnonymizedData",
|
309
|
+
"UserAnonymizedData",
|
310
|
+
"UserData",
|
311
|
+
"UserData",
|
312
|
+
"UserTasks",
|
313
|
+
"UserTasks",
|
314
|
+
"WebhooksOptions",
|
315
|
+
"WebhooksType",
|
316
|
+
"WebhooksUser",
|
317
|
+
"__version__",
|
318
|
+
"deserialize_task",
|
319
|
+
"extract_avatar",
|
320
|
+
]
|
@@ -10,7 +10,7 @@ import uuid
|
|
10
10
|
import aiohttp
|
11
11
|
|
12
12
|
from .const import DEVELOPER_ID, __version__
|
13
|
-
from .
|
13
|
+
from .typedefs import Avatar, UserData
|
14
14
|
|
15
15
|
|
16
16
|
def join_fields(user_fields: list[str] | str) -> str:
|
@@ -111,10 +111,10 @@ def get_x_client(x_client: str | None = None) -> str:
|
|
111
111
|
return f"{DEVELOPER_ID} - Habiticalib/{__version__}"
|
112
112
|
|
113
113
|
|
114
|
-
def
|
115
|
-
"""Extract
|
116
|
-
|
117
|
-
return
|
114
|
+
def extract_avatar(user_data: UserData) -> Avatar:
|
115
|
+
"""Extract avatar defs from a user data object."""
|
116
|
+
|
117
|
+
return Avatar.from_dict(user_data.to_dict())
|
118
118
|
|
119
119
|
|
120
120
|
def deserialize_task(value: Any) -> Any: # noqa: PLR0911
|
@@ -29,13 +29,14 @@ from .exceptions import (
|
|
29
29
|
)
|
30
30
|
from .helpers import (
|
31
31
|
deserialize_task,
|
32
|
-
|
32
|
+
extract_avatar,
|
33
33
|
get_user_agent,
|
34
34
|
get_x_client,
|
35
35
|
join_fields,
|
36
36
|
)
|
37
|
-
from .
|
37
|
+
from .typedefs import (
|
38
38
|
Attributes,
|
39
|
+
Avatar,
|
39
40
|
Direction,
|
40
41
|
HabiticaCastSkillResponse,
|
41
42
|
HabiticaClass,
|
@@ -61,7 +62,6 @@ from .types import (
|
|
61
62
|
Skill,
|
62
63
|
Task,
|
63
64
|
TaskFilter,
|
64
|
-
UserStyles,
|
65
65
|
)
|
66
66
|
|
67
67
|
if TYPE_CHECKING:
|
@@ -1845,12 +1845,12 @@ class Habitica:
|
|
1845
1845
|
async def generate_avatar( # noqa: PLR0912, PLR0915
|
1846
1846
|
self,
|
1847
1847
|
fp: str | IO[bytes],
|
1848
|
-
|
1848
|
+
avatar: Avatar | None = None,
|
1849
1849
|
fmt: str | None = None,
|
1850
|
-
) ->
|
1851
|
-
"""Generate an avatar image based on the provided
|
1850
|
+
) -> Avatar:
|
1851
|
+
"""Generate an avatar image based on the provided avatar object or fetched user data.
|
1852
1852
|
|
1853
|
-
If no `
|
1853
|
+
If no `Avatar` object is provided, the method retrieves user preferences, items, and stats
|
1854
1854
|
for the authenticated user and builds the avatar accordingly. The base image is initialized
|
1855
1855
|
as a transparent RGBA image of size (141, 147). A mount offset is applied based on the user's
|
1856
1856
|
current mount status.
|
@@ -1864,8 +1864,8 @@ class Habitica:
|
|
1864
1864
|
----------
|
1865
1865
|
fp : str or IO[bytes]
|
1866
1866
|
The file path or a bytes buffer to store or modify the avatar image.
|
1867
|
-
|
1868
|
-
The user
|
1867
|
+
avatar : Avatar, optional
|
1868
|
+
The user avatar preferences, items, and stats. If not provided, the method will fetch
|
1869
1869
|
this data.
|
1870
1870
|
fmt : str
|
1871
1871
|
If a file object is used instead of a filename, the format
|
@@ -1873,8 +1873,8 @@ class Habitica:
|
|
1873
1873
|
|
1874
1874
|
Returns
|
1875
1875
|
-------
|
1876
|
-
|
1877
|
-
The user
|
1876
|
+
Avatar
|
1877
|
+
The user avatar definitions used to generate the avatar.
|
1878
1878
|
|
1879
1879
|
Examples
|
1880
1880
|
--------
|
@@ -1885,13 +1885,15 @@ class Habitica:
|
|
1885
1885
|
Using a file path:
|
1886
1886
|
>>> await habitica.generate_avatar("/path/to/image/avatar.png")
|
1887
1887
|
"""
|
1888
|
-
if not
|
1889
|
-
|
1890
|
-
|
1888
|
+
if not avatar:
|
1889
|
+
avatar = extract_avatar(
|
1890
|
+
(
|
1891
|
+
await self.get_user(user_fields=["preferences", "items", "stats"])
|
1892
|
+
).data,
|
1891
1893
|
)
|
1892
|
-
preferences =
|
1893
|
-
items =
|
1894
|
-
stats =
|
1894
|
+
preferences = avatar.preferences
|
1895
|
+
items = avatar.items
|
1896
|
+
stats = avatar.stats
|
1895
1897
|
mount_offset_y = 0 if items.currentMount else 24
|
1896
1898
|
|
1897
1899
|
# Initializing the base image
|
@@ -2040,7 +2042,7 @@ class Habitica:
|
|
2040
2042
|
else:
|
2041
2043
|
image.save(fp, fmt)
|
2042
2044
|
|
2043
|
-
return
|
2045
|
+
return avatar
|
2044
2046
|
|
2045
2047
|
async def habitipy(self) -> HabitipyAsync:
|
2046
2048
|
"""Create a Habitipy instance."""
|