Habiticalib 0.2.0a0__py3-none-any.whl → 0.2.0a1__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 +2 -0
- habiticalib/const.py +3 -1
- habiticalib/lib.py +441 -2
- habiticalib/types.py +27 -1
- {habiticalib-0.2.0a0.dist-info → habiticalib-0.2.0a1.dist-info}/METADATA +1 -1
- habiticalib-0.2.0a1.dist-info/RECORD +11 -0
- habiticalib-0.2.0a0.dist-info/RECORD +0 -11
- {habiticalib-0.2.0a0.dist-info → habiticalib-0.2.0a1.dist-info}/WHEEL +0 -0
- {habiticalib-0.2.0a0.dist-info → habiticalib-0.2.0a1.dist-info}/licenses/LICENSE +0 -0
habiticalib/__init__.py
CHANGED
@@ -16,6 +16,7 @@ from .types import (
|
|
16
16
|
HabiticaClass,
|
17
17
|
HabiticaClassSystemResponse,
|
18
18
|
HabiticaErrorResponse,
|
19
|
+
HabiticaGroupMembersResponse,
|
19
20
|
HabiticaLoginResponse,
|
20
21
|
HabiticaResponse,
|
21
22
|
HabiticaScoreResponse,
|
@@ -49,6 +50,7 @@ __all__ = [
|
|
49
50
|
"HabiticaClassSystemResponse",
|
50
51
|
"HabiticaErrorResponse",
|
51
52
|
"HabiticaException",
|
53
|
+
"HabiticaGroupMembersResponse",
|
52
54
|
"HabiticaLoginResponse",
|
53
55
|
"HabiticaResponse",
|
54
56
|
"HabiticaScoreResponse",
|
habiticalib/const.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
"""Constants for Habiticalib."""
|
2
2
|
|
3
|
-
__version__ = "0.2.
|
3
|
+
__version__ = "0.2.0a1"
|
4
4
|
|
5
5
|
DEFAULT_URL = "https://habitica.com/"
|
6
6
|
ASSETS_URL = "https://habitica-assets.s3.amazonaws.com/mobileApp/images/"
|
@@ -14,3 +14,5 @@ BACKER_ONLY_GEAR = {
|
|
14
14
|
"shield_special_ks2019": "BackerOnly-Equip-MythicGryphonShield.gif",
|
15
15
|
"weapon_special_ks2019": "BackerOnly-Equip-MythicGryphonGlaive.gif",
|
16
16
|
}
|
17
|
+
|
18
|
+
PAGE_LIMIT = 60
|
habiticalib/lib.py
CHANGED
@@ -12,7 +12,7 @@ from aiohttp import ClientError, ClientResponseError, ClientSession
|
|
12
12
|
from PIL import Image
|
13
13
|
from yarl import URL
|
14
14
|
|
15
|
-
from .const import ASSETS_URL, BACKER_ONLY_GEAR, DEFAULT_URL
|
15
|
+
from .const import ASSETS_URL, BACKER_ONLY_GEAR, DEFAULT_URL, PAGE_LIMIT
|
16
16
|
from .exceptions import (
|
17
17
|
BadRequestError,
|
18
18
|
NotAuthorizedError,
|
@@ -32,7 +32,9 @@ from .types import (
|
|
32
32
|
HabiticaClass,
|
33
33
|
HabiticaClassSystemResponse,
|
34
34
|
HabiticaErrorResponse,
|
35
|
+
HabiticaGroupMembersResponse,
|
35
36
|
HabiticaLoginResponse,
|
37
|
+
HabiticaQuestResponse,
|
36
38
|
HabiticaResponse,
|
37
39
|
HabiticaScoreResponse,
|
38
40
|
HabiticaSleepResponse,
|
@@ -849,7 +851,7 @@ class Habitica:
|
|
849
851
|
if target_id:
|
850
852
|
params.update({"targetId": str(target_id)})
|
851
853
|
return HabiticaUserResponse.from_json(
|
852
|
-
await self._request("post", url=url,
|
854
|
+
await self._request("post", url=url, params=params),
|
853
855
|
)
|
854
856
|
|
855
857
|
async def toggle_sleep(
|
@@ -1281,6 +1283,443 @@ class Habitica:
|
|
1281
1283
|
await self._request("post", url=url, json=json),
|
1282
1284
|
)
|
1283
1285
|
|
1286
|
+
async def get_group_members(
|
1287
|
+
self,
|
1288
|
+
group_id: UUID | None = None,
|
1289
|
+
*,
|
1290
|
+
limit: int | None = None,
|
1291
|
+
tasks: bool = False,
|
1292
|
+
public_fields: bool = False,
|
1293
|
+
last_id: UUID | None = None,
|
1294
|
+
) -> HabiticaGroupMembersResponse:
|
1295
|
+
"""Get members of the party or a specific group.
|
1296
|
+
|
1297
|
+
This method retrieves a list of members for a party or a specified group
|
1298
|
+
from the Habitica API. Additional options allow including tasks or public
|
1299
|
+
through results if necessary to collect all members. If the API rate limit is
|
1300
|
+
exceeded, the method will pause for the duration specified in the `retry-after`
|
1301
|
+
header and retry the request.
|
1302
|
+
|
1303
|
+
|
1304
|
+
Parameters
|
1305
|
+
----------
|
1306
|
+
group_id : UUID, optional
|
1307
|
+
The UUID of the group. Defaults to the user's party if not specified.
|
1308
|
+
limit : int, optional
|
1309
|
+
Maximum number of members per request (default: 30, max: 60).
|
1310
|
+
tasks : bool, optional
|
1311
|
+
Whether to include tasks associated with the group.
|
1312
|
+
public_fields : bool, optional
|
1313
|
+
Whether to include all public fields for group members.
|
1314
|
+
last_id : UUID, optional
|
1315
|
+
For paginated requests, the UUID of the last member retrieved.
|
1316
|
+
|
1317
|
+
Returns
|
1318
|
+
-------
|
1319
|
+
HabiticaGroupMembersResponse
|
1320
|
+
A response object containing the group member data.
|
1321
|
+
|
1322
|
+
Raises
|
1323
|
+
------
|
1324
|
+
aiohttp.ClientResponseError
|
1325
|
+
For HTTP-related errors, such as HTTP 400 or 500 response status.
|
1326
|
+
aiohttp.ClientConnectionError
|
1327
|
+
If the connection to the API fails.
|
1328
|
+
aiohttp.ClientError
|
1329
|
+
For any other exceptions raised by aiohttp during the request.
|
1330
|
+
TimeoutError
|
1331
|
+
If the connection times out.
|
1332
|
+
|
1333
|
+
Examples
|
1334
|
+
--------
|
1335
|
+
>>> members_response = await habitica.get_group_members()
|
1336
|
+
>>> for member in members_response.data:
|
1337
|
+
... print(member.profile.name)
|
1338
|
+
"""
|
1339
|
+
|
1340
|
+
if limit is not None and (limit < 1 or limit > PAGE_LIMIT):
|
1341
|
+
msg = f"The 'limit' parameter must be between 1 and {PAGE_LIMIT}."
|
1342
|
+
raise ValueError(msg)
|
1343
|
+
|
1344
|
+
group = "party" if not group_id else str(group_id)
|
1345
|
+
url = self.url / "api/v3/groups" / group / "members"
|
1346
|
+
|
1347
|
+
params: dict[str, str | int] = {}
|
1348
|
+
|
1349
|
+
if tasks:
|
1350
|
+
params["includeTasks"] = "true"
|
1351
|
+
if public_fields:
|
1352
|
+
params["includeAllPublicFields"] = "true"
|
1353
|
+
if last_id:
|
1354
|
+
params["lastId"] = str(last_id)
|
1355
|
+
if limit:
|
1356
|
+
params["limit"] = limit
|
1357
|
+
|
1358
|
+
while True:
|
1359
|
+
try:
|
1360
|
+
response = HabiticaGroupMembersResponse.from_json(
|
1361
|
+
await self._request("get", url=url, params=params),
|
1362
|
+
)
|
1363
|
+
break
|
1364
|
+
except TooManyRequestsError as e:
|
1365
|
+
await asyncio.sleep(e.retry_after)
|
1366
|
+
|
1367
|
+
if len(response.data) == limit:
|
1368
|
+
next_page = await self.get_group_members(
|
1369
|
+
group_id=group_id,
|
1370
|
+
limit=limit,
|
1371
|
+
tasks=tasks,
|
1372
|
+
public_fields=public_fields,
|
1373
|
+
last_id=response.data[-1].id,
|
1374
|
+
)
|
1375
|
+
response.data.extend(next_page.data)
|
1376
|
+
|
1377
|
+
return response
|
1378
|
+
|
1379
|
+
async def abort_quest(self, group_id: UUID | None = None) -> HabiticaQuestResponse:
|
1380
|
+
"""Abort an active quest for the party or a specific group.
|
1381
|
+
|
1382
|
+
Prematurely terminates an ongoing quest, causing all progress to be lost.
|
1383
|
+
The quest scroll will be returned to the owner's inventory.
|
1384
|
+
Only the quest leader or group leader is allowed to perform this action.
|
1385
|
+
|
1386
|
+
Parameters
|
1387
|
+
----------
|
1388
|
+
group_id : UUID, optional
|
1389
|
+
The UUID of the specific group whose quest should be aborted.
|
1390
|
+
Defaults to the user's party if not specified.
|
1391
|
+
|
1392
|
+
Returns
|
1393
|
+
-------
|
1394
|
+
HabiticaQuestResponse
|
1395
|
+
A response object containing updated quest data of the group or party.
|
1396
|
+
|
1397
|
+
Raises
|
1398
|
+
------
|
1399
|
+
NotFoundError
|
1400
|
+
If the specified group or quest could not be found.
|
1401
|
+
NotAuthorizedError
|
1402
|
+
If the user does not have permission to abort the quest.
|
1403
|
+
aiohttp.ClientResponseError
|
1404
|
+
For HTTP-related errors, such as HTTP 400 or 500 response status.
|
1405
|
+
aiohttp.ClientConnectionError
|
1406
|
+
If the connection to the API fails.
|
1407
|
+
aiohttp.ClientError
|
1408
|
+
For any other exceptions raised by aiohttp during the request.
|
1409
|
+
TimeoutError
|
1410
|
+
If the connection times out.
|
1411
|
+
|
1412
|
+
Examples
|
1413
|
+
--------
|
1414
|
+
Abort the party's current quest:
|
1415
|
+
>>> response = await habitica.abort_quest()
|
1416
|
+
>>> print(response.success) # True if the quest was successfully aborted.
|
1417
|
+
|
1418
|
+
Abort a quest for a specific group:
|
1419
|
+
>>> group_id = UUID("12345678-1234-5678-1234-567812345678")
|
1420
|
+
>>> response = await habitica.abort_quest(group_id)
|
1421
|
+
>>> print(response.success) # True if the quest was successfully aborted.
|
1422
|
+
"""
|
1423
|
+
group = "party" if not group_id else str(group_id)
|
1424
|
+
url = self.url / "api/v3/groups" / group / "quests/abort"
|
1425
|
+
|
1426
|
+
return HabiticaQuestResponse.from_json(
|
1427
|
+
await self._request("post", url=url),
|
1428
|
+
)
|
1429
|
+
|
1430
|
+
async def accept_quest(self, group_id: UUID | None = None) -> HabiticaQuestResponse:
|
1431
|
+
"""Accept a pending invitation to a quest from the party or a specific group.
|
1432
|
+
|
1433
|
+
Allows a user to accept an invitation to participate in a quest within a
|
1434
|
+
specified group.
|
1435
|
+
|
1436
|
+
Parameters
|
1437
|
+
----------
|
1438
|
+
group_id : UUID, optional
|
1439
|
+
The UUID of the group for which the quest invitation is being accepted.
|
1440
|
+
Defaults to the user's party if not specified.
|
1441
|
+
|
1442
|
+
|
1443
|
+
Returns
|
1444
|
+
-------
|
1445
|
+
HabiticaQuestResponse
|
1446
|
+
A response object containing updated quest data of the group or party.
|
1447
|
+
|
1448
|
+
Raises
|
1449
|
+
------
|
1450
|
+
NotFoundError
|
1451
|
+
If the specified group or quest could not be found.
|
1452
|
+
aiohttp.ClientResponseError
|
1453
|
+
Raised for HTTP-related errors, such as HTTP 400 or 500 response status.
|
1454
|
+
aiohttp.ClientConnectionError
|
1455
|
+
If the connection to the API fails.
|
1456
|
+
aiohttp.ClientError
|
1457
|
+
Raised for any other exceptions encountered by `aiohttp` during the request.
|
1458
|
+
TimeoutError
|
1459
|
+
If the connection to the API times out.
|
1460
|
+
|
1461
|
+
Examples
|
1462
|
+
--------
|
1463
|
+
Accept a pending quest invitation from the party:
|
1464
|
+
>>> response = await habitica.accept_quest()
|
1465
|
+
>>> print(response.success) # True if the quest invitation was successfully accepted.
|
1466
|
+
"""
|
1467
|
+
group = "party" if not group_id else str(group_id)
|
1468
|
+
url = self.url / "api/v3/groups" / group / "quests/accept"
|
1469
|
+
|
1470
|
+
return HabiticaQuestResponse.from_json(
|
1471
|
+
await self._request("post", url=url),
|
1472
|
+
)
|
1473
|
+
|
1474
|
+
async def reject_quest(self, group_id: UUID | None = None) -> HabiticaQuestResponse:
|
1475
|
+
"""Reject a pending quest invitation from the party or a specific group.
|
1476
|
+
|
1477
|
+
Allows a user to reject an invitation to participate in a quest within a
|
1478
|
+
specified group. The user will not join the quest and will be excluded from
|
1479
|
+
its progress and rewards.
|
1480
|
+
|
1481
|
+
Parameters
|
1482
|
+
----------
|
1483
|
+
group_id : UUID, optional
|
1484
|
+
The UUID of the group for which the quest invitation is being rejected.
|
1485
|
+
Defaults to the user's party if not specified.
|
1486
|
+
|
1487
|
+
|
1488
|
+
Returns
|
1489
|
+
-------
|
1490
|
+
HabiticaQuestResponse
|
1491
|
+
A response object containing updated quest data of the group or party.
|
1492
|
+
|
1493
|
+
Raises
|
1494
|
+
------
|
1495
|
+
NotFoundError
|
1496
|
+
If the specified group or quest could not be found.
|
1497
|
+
aiohttp.ClientResponseError
|
1498
|
+
Raised for HTTP-related errors, such as HTTP 400 or 500 response status.
|
1499
|
+
aiohttp.ClientConnectionError
|
1500
|
+
If the connection to the API fails.
|
1501
|
+
aiohttp.ClientError
|
1502
|
+
Raised for any other exceptions encountered by `aiohttp` during the request.
|
1503
|
+
TimeoutError
|
1504
|
+
If the connection to the API times out.
|
1505
|
+
|
1506
|
+
Examples
|
1507
|
+
--------
|
1508
|
+
Reject a pending quest invitation from the party:
|
1509
|
+
>>> response = await habitica.reject_quest()
|
1510
|
+
>>> print(response.success) # True if the quest invitation was successfully rejected.
|
1511
|
+
|
1512
|
+
Reject a pending quest invitation from a specific group:
|
1513
|
+
>>> group_id = UUID("12345678-1234-5678-1234-567812345678")
|
1514
|
+
>>> response = await habitica.reject_quest(group_id)
|
1515
|
+
>>> print(response.success) # True if the quest invitation was successfully rejected.
|
1516
|
+
"""
|
1517
|
+
group = "party" if not group_id else str(group_id)
|
1518
|
+
url = self.url / "api/v3/groups" / group / "quests/reject"
|
1519
|
+
|
1520
|
+
return HabiticaQuestResponse.from_json(
|
1521
|
+
await self._request("post", url=url),
|
1522
|
+
)
|
1523
|
+
|
1524
|
+
async def cancel_quest(self, group_id: UUID | None = None) -> HabiticaQuestResponse:
|
1525
|
+
"""Cancel a pending quest for the party or a specific group.
|
1526
|
+
|
1527
|
+
Cancel a quest that has not yet startet. All accepted and pending invitations
|
1528
|
+
will be canceled and the quest roll returned to the owner's inventory.
|
1529
|
+
Only quest leader or group leader can perform this action.
|
1530
|
+
|
1531
|
+
Parameters
|
1532
|
+
----------
|
1533
|
+
group_id : UUID, optional
|
1534
|
+
The UUID of the group for which the quest is being canceled.
|
1535
|
+
Defaults to the user's party if not specified.
|
1536
|
+
|
1537
|
+
Returns
|
1538
|
+
-------
|
1539
|
+
HabiticaQuestResponse
|
1540
|
+
A response object containing details about the canceled quest.
|
1541
|
+
|
1542
|
+
Raises
|
1543
|
+
------
|
1544
|
+
NotFoundError
|
1545
|
+
If the specified group or quest could not be found.
|
1546
|
+
NotAuthorizedError
|
1547
|
+
If the user does not have permission to cancel the quest.
|
1548
|
+
aiohttp.ClientResponseError
|
1549
|
+
Raised for HTTP-related errors, such as HTTP 400 or 500 response status.
|
1550
|
+
aiohttp.ClientConnectionError
|
1551
|
+
If the connection to the API fails.
|
1552
|
+
aiohttp.ClientError
|
1553
|
+
Raised for any other exceptions encountered by `aiohttp` during the request.
|
1554
|
+
TimeoutError
|
1555
|
+
If the connection to the API times out.
|
1556
|
+
|
1557
|
+
Examples
|
1558
|
+
--------
|
1559
|
+
Cancel a pending quest for the party:
|
1560
|
+
>>> response = await habitica.cancel_quest()
|
1561
|
+
>>> print(response.success) # True if the quest was successfully canceled.
|
1562
|
+
"""
|
1563
|
+
group = "party" if not group_id else str(group_id)
|
1564
|
+
url = self.url / "api/v3/groups" / group / "quests/cancel"
|
1565
|
+
|
1566
|
+
return HabiticaQuestResponse.from_json(
|
1567
|
+
await self._request("post", url=url),
|
1568
|
+
)
|
1569
|
+
|
1570
|
+
async def start_quest(self, group_id: UUID | None = None) -> HabiticaQuestResponse:
|
1571
|
+
"""Force-start a quest for the party or a specific group.
|
1572
|
+
|
1573
|
+
Begins a quest immediately, bypassing any pending invitations that haven't been
|
1574
|
+
accepted or rejected.
|
1575
|
+
Only quest leader or group leader can perform this action.
|
1576
|
+
|
1577
|
+
Parameters
|
1578
|
+
----------
|
1579
|
+
group_id : UUID, optional
|
1580
|
+
The UUID of the group for which the quest should be started.
|
1581
|
+
Defaults to the user's party if not specified.
|
1582
|
+
|
1583
|
+
|
1584
|
+
Returns
|
1585
|
+
-------
|
1586
|
+
HabiticaQuestResponse
|
1587
|
+
A response object containing updated quest data of the group or party.
|
1588
|
+
|
1589
|
+
Raises
|
1590
|
+
------
|
1591
|
+
NotFoundError
|
1592
|
+
If the specified group or quest could not be found.
|
1593
|
+
NotAuthorizedError
|
1594
|
+
If the user does not have permission to start the quest.
|
1595
|
+
aiohttp.ClientResponseError
|
1596
|
+
Raised for HTTP-related errors, such as HTTP 400 or 500 response status.
|
1597
|
+
aiohttp.ClientConnectionError
|
1598
|
+
If the connection to the API fails.
|
1599
|
+
aiohttp.ClientError
|
1600
|
+
Raised for any other exceptions encountered by `aiohttp` during the request.
|
1601
|
+
TimeoutError
|
1602
|
+
If the connection to the API times out.
|
1603
|
+
|
1604
|
+
Examples
|
1605
|
+
--------
|
1606
|
+
Cancel a pending quest for the party:
|
1607
|
+
>>> response = await habitica.cancel_quest()
|
1608
|
+
>>> print(response.success) # True if the quest was successfully canceled.
|
1609
|
+
"""
|
1610
|
+
group = "party" if not group_id else str(group_id)
|
1611
|
+
url = self.url / "api/v3/groups" / group / "quests/force-start"
|
1612
|
+
|
1613
|
+
return HabiticaQuestResponse.from_json(
|
1614
|
+
await self._request("post", url=url),
|
1615
|
+
)
|
1616
|
+
|
1617
|
+
async def invite_quest(
|
1618
|
+
self,
|
1619
|
+
group_id: UUID | None = None,
|
1620
|
+
*,
|
1621
|
+
quest_key: str,
|
1622
|
+
) -> HabiticaQuestResponse:
|
1623
|
+
"""Invite members of the party or a specific group to participate in a quest.
|
1624
|
+
|
1625
|
+
Sends invitations for a quest to all eligible members of the specified group.
|
1626
|
+
The quest is started when all members accept or reject the invitation.
|
1627
|
+
|
1628
|
+
Parameters
|
1629
|
+
----------
|
1630
|
+
group_id : UUID, optional
|
1631
|
+
The UUID of the group for which the quest invitations should be sent.
|
1632
|
+
Defaults to the user's party if not specified.
|
1633
|
+
quest_key : str
|
1634
|
+
The unique key identifying the quest to invite members to.
|
1635
|
+
|
1636
|
+
Returns
|
1637
|
+
-------
|
1638
|
+
HabiticaQuestResponse
|
1639
|
+
A response object containing updated quest data of the group or party.
|
1640
|
+
|
1641
|
+
Raises
|
1642
|
+
------
|
1643
|
+
NotFoundError
|
1644
|
+
If the specified group or quest could not be found.
|
1645
|
+
aiohttp.ClientResponseError
|
1646
|
+
Raised for HTTP-related errors, such as HTTP 400 or 500 response status.
|
1647
|
+
aiohttp.ClientConnectionError
|
1648
|
+
If the connection to the API fails.
|
1649
|
+
aiohttp.ClientError
|
1650
|
+
Raised for any other exceptions encountered by `aiohttp` during the request.
|
1651
|
+
TimeoutError
|
1652
|
+
If the connection to the API times out.
|
1653
|
+
|
1654
|
+
Examples
|
1655
|
+
--------
|
1656
|
+
Send a quest invitation to the party:
|
1657
|
+
>>> response = await habitica.invite_quest(quest_key="dilatory_derby")
|
1658
|
+
>>> print(response.success) # True if invitations were successfully sent.
|
1659
|
+
|
1660
|
+
Send a quest invitation to a specific group:
|
1661
|
+
>>> group_id = UUID("12345678-1234-5678-1234-567812345678")
|
1662
|
+
>>> response = await habitica.invite_quest(group_id, quest_key="golden_knight")
|
1663
|
+
>>> print(response.success) # True if invitations were successfully sent.
|
1664
|
+
"""
|
1665
|
+
group = "party" if not group_id else str(group_id)
|
1666
|
+
url = self.url / "api/v3/groups" / group / "quests/invite" / quest_key
|
1667
|
+
|
1668
|
+
return HabiticaQuestResponse.from_json(
|
1669
|
+
await self._request("post", url=url),
|
1670
|
+
)
|
1671
|
+
|
1672
|
+
async def leave_quest(self, group_id: UUID | None = None) -> HabiticaQuestResponse:
|
1673
|
+
"""Leave the current quest from the party or a specific group.
|
1674
|
+
|
1675
|
+
Allows a user to exit an ongoing quest they are part of. This action removes
|
1676
|
+
them from the quest but does not affect its progress for other participants.
|
1677
|
+
Users who leave a quest will not contribute to its completion or receive rewards.
|
1678
|
+
|
1679
|
+
Parameters
|
1680
|
+
----------
|
1681
|
+
group_id : UUID, optional
|
1682
|
+
The UUID of the group associated with the quest the user is leaving.
|
1683
|
+
Defaults to the user's party if not specified.
|
1684
|
+
quest_key : str
|
1685
|
+
The unique key identifying the quest to invite members to.
|
1686
|
+
|
1687
|
+
Returns
|
1688
|
+
-------
|
1689
|
+
HabiticaQuestResponse
|
1690
|
+
A response object containing updated quest data of the group or party.
|
1691
|
+
|
1692
|
+
Raises
|
1693
|
+
------
|
1694
|
+
NotFoundError
|
1695
|
+
If the specified group or quest could not be found.
|
1696
|
+
aiohttp.ClientResponseError
|
1697
|
+
Raised for HTTP-related errors, such as HTTP 400 or 500 response status.
|
1698
|
+
aiohttp.ClientConnectionError
|
1699
|
+
If the connection to the API fails.
|
1700
|
+
aiohttp.ClientError
|
1701
|
+
Raised for any other exceptions encountered by `aiohttp` during the request.
|
1702
|
+
TimeoutError
|
1703
|
+
If the connection to the API times out.
|
1704
|
+
|
1705
|
+
Examples
|
1706
|
+
--------
|
1707
|
+
Leave the current quest in the user's party:
|
1708
|
+
>>> response = await habitica.leave_quest()
|
1709
|
+
>>> print(response.success) # True if the user successfully left the quest.
|
1710
|
+
|
1711
|
+
Leave the current quest in a specific group:
|
1712
|
+
>>> group_id = UUID("12345678-1234-5678-1234-567812345678")
|
1713
|
+
>>> response = await habitica.leave_quest(group_id)
|
1714
|
+
>>> print(response.success) # True if the user successfully left the quest.
|
1715
|
+
"""
|
1716
|
+
group = "party" if not group_id else str(group_id)
|
1717
|
+
url = self.url / "api/v3/groups" / group / "quests/leave"
|
1718
|
+
|
1719
|
+
return HabiticaQuestResponse.from_json(
|
1720
|
+
await self._request("post", url=url),
|
1721
|
+
)
|
1722
|
+
|
1284
1723
|
def _cache_asset(self, asset: str, asset_data: IO[bytes]) -> None:
|
1285
1724
|
"""Cache an asset and maintain the cache size limit by removing older entries.
|
1286
1725
|
|
habiticalib/types.py
CHANGED
@@ -777,6 +777,13 @@ class HabiticaUserResponse(HabiticaResponse):
|
|
777
777
|
data: UserData
|
778
778
|
|
779
779
|
|
780
|
+
@dataclass(kw_only=True)
|
781
|
+
class HabiticaGroupMembersResponse(HabiticaResponse):
|
782
|
+
"""Representation of a group members data response."""
|
783
|
+
|
784
|
+
data: list[UserData]
|
785
|
+
|
786
|
+
|
780
787
|
@dataclass(kw_only=True)
|
781
788
|
class CompletedBy:
|
782
789
|
"""Task group completedby data."""
|
@@ -1107,6 +1114,25 @@ class HabiticaTagResponse(HabiticaResponse, DataClassORJSONMixin):
|
|
1107
1114
|
data: TagsUser
|
1108
1115
|
|
1109
1116
|
|
1117
|
+
@dataclass(kw_only=True)
|
1118
|
+
class QuestData:
|
1119
|
+
"""Quest data."""
|
1120
|
+
|
1121
|
+
progress: ProgressQuest = field(default_factory=ProgressQuest)
|
1122
|
+
active: bool = False
|
1123
|
+
members: dict[str, bool | None]
|
1124
|
+
extra: dict | None = None
|
1125
|
+
key: str
|
1126
|
+
leader: UUID | None = None
|
1127
|
+
|
1128
|
+
|
1129
|
+
@dataclass(kw_only=True)
|
1130
|
+
class HabiticaQuestResponse(HabiticaResponse, DataClassORJSONMixin):
|
1131
|
+
"""Representation of a quest response."""
|
1132
|
+
|
1133
|
+
data: QuestData
|
1134
|
+
|
1135
|
+
|
1110
1136
|
@dataclass
|
1111
1137
|
class ChangeClassData:
|
1112
1138
|
"""Change class data."""
|
@@ -1194,7 +1220,7 @@ class Skill(StrEnum):
|
|
1194
1220
|
VALOROUS_PRESENCE = "valorousPresence"
|
1195
1221
|
INTIMIDATING_GAZE = "intimidate"
|
1196
1222
|
# Rogue skills
|
1197
|
-
PICKPOCKET = "
|
1223
|
+
PICKPOCKET = "pickPocket"
|
1198
1224
|
BACKSTAB = "backStab"
|
1199
1225
|
TOOLS_OF_THE_TRADE = "toolsOfTrade"
|
1200
1226
|
STEALTH = "stealth"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.3
|
2
2
|
Name: Habiticalib
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.0a1
|
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
|
@@ -0,0 +1,11 @@
|
|
1
|
+
habiticalib/__init__.py,sha256=QwR7xcAdEwZ1bAv02KlZCm4sw-8-xKlYOUAaB502mCA,1687
|
2
|
+
habiticalib/const.py,sha256=hTmR0O6Bibw96tMCIy-Wsb_AC0K4AH1qiQVCJyJ_TAg,626
|
3
|
+
habiticalib/exceptions.py,sha256=oVFCGbHkVn0UpIKIPZPzXfvzs9US4R05ebdEn6cOpqM,1350
|
4
|
+
habiticalib/helpers.py,sha256=IRZLYWkDVLI0iVBgBMmvZ6L83KCUl-CnzGhUR_tP6Fg,4576
|
5
|
+
habiticalib/lib.py,sha256=_HPEjoH1o0wbSM26mIbzGEbfvAery3O8XDMTmUZEY2U,71271
|
6
|
+
habiticalib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
habiticalib/types.py,sha256=ZmAkkDzXl9lj9fNWidlzjKkJ0CQStQVBi24u-3mgMPA,33907
|
8
|
+
habiticalib-0.2.0a1.dist-info/METADATA,sha256=Yfdhp5dWPEylm1Ri2yU1zC2569oODmC6vSCERfG80mY,4156
|
9
|
+
habiticalib-0.2.0a1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
10
|
+
habiticalib-0.2.0a1.dist-info/licenses/LICENSE,sha256=oIinIOSJ49l1iVIRI3XGXFWt6SF7a83kEFBAY8ORwNI,1084
|
11
|
+
habiticalib-0.2.0a1.dist-info/RECORD,,
|
@@ -1,11 +0,0 @@
|
|
1
|
-
habiticalib/__init__.py,sha256=gR6mjGbUe7tD3bR5UDSPXgKCtP-rfgknHi-XIP41HLk,1617
|
2
|
-
habiticalib/const.py,sha256=tJbptyPWBga1PdjCeDzutNCVsT5BIyvO9nUfFGO1D90,609
|
3
|
-
habiticalib/exceptions.py,sha256=oVFCGbHkVn0UpIKIPZPzXfvzs9US4R05ebdEn6cOpqM,1350
|
4
|
-
habiticalib/helpers.py,sha256=IRZLYWkDVLI0iVBgBMmvZ6L83KCUl-CnzGhUR_tP6Fg,4576
|
5
|
-
habiticalib/lib.py,sha256=JXx7PGrl74fJdTj_TKKzIr84Kl-hgCBDy0yvaMXXgD8,54316
|
6
|
-
habiticalib/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
habiticalib/types.py,sha256=DAIKNhsc0KWSWBcfVrcP7XeZ3QlbFsuWyxt_326Lrvw,33309
|
8
|
-
habiticalib-0.2.0a0.dist-info/METADATA,sha256=d_1DFcqvff_2feSeV1blBEmOlkZ1qChdQMxKirA7ics,4156
|
9
|
-
habiticalib-0.2.0a0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
|
10
|
-
habiticalib-0.2.0a0.dist-info/licenses/LICENSE,sha256=oIinIOSJ49l1iVIRI3XGXFWt6SF7a83kEFBAY8ORwNI,1084
|
11
|
-
habiticalib-0.2.0a0.dist-info/RECORD,,
|
File without changes
|
File without changes
|