yoto-api 4.4.1__tar.gz → 4.4.2__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.
- {yoto_api-4.4.1 → yoto_api-4.4.2}/PKG-INFO +1 -1
- {yoto_api-4.4.1 → yoto_api-4.4.2}/setup.py +1 -1
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/test_client.py +13 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/client.py +15 -15
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api.egg-info/PKG-INFO +1 -1
- {yoto_api-4.4.1 → yoto_api-4.4.2}/AUTHORS.rst +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/CONTRIBUTING.rst +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/HISTORY.rst +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/LICENSE +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/MANIFEST.in +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/README.md +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/requirements.txt +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/setup.cfg +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/__init__.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/conftest.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/e2e/__init__.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/e2e/conftest.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/e2e/test_basic.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/e2e/test_mqtt.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/e2e/test_shapes.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/e2e/test_writes.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/test_account.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/test_capabilities.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/test_concurrent_refresh.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/test_models.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/test_mqtt_client.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/test_mqtt_parser.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/test_status_adapter.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/tests/test_utils.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/Card.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/Group.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/Token.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/__init__.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/_coerce.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/account.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/auth.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/capabilities.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/const.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/exceptions.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/models/__init__.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/models/config.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/models/device.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/models/event.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/models/info.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/models/player.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/models/status.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/mqtt/__init__.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/mqtt/client.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/mqtt/parser.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/py.typed +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/rest/__init__.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/rest/client.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/rest/endpoints.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/rest/requests.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/status_adapter.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api/utils.py +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api.egg-info/SOURCES.txt +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api.egg-info/dependency_links.txt +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api.egg-info/not-zip-safe +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api.egg-info/requires.txt +0 -0
- {yoto_api-4.4.1 → yoto_api-4.4.2}/yoto_api.egg-info/top_level.txt +0 -0
|
@@ -143,6 +143,19 @@ class UpdateLibraryTests(_ClientTestCase):
|
|
|
143
143
|
self.assertEqual(card.author, "Yoto")
|
|
144
144
|
self.assertEqual(card.description, "A story about fear")
|
|
145
145
|
|
|
146
|
+
async def test_keeps_numeric_looking_strings_as_strings(self) -> None:
|
|
147
|
+
client = self.make_client()
|
|
148
|
+
client.token = fresh_token()
|
|
149
|
+
client._rest.get_card_library = AsyncMock(
|
|
150
|
+
return_value={"cards": [{"cardId": "12345", "card": {"title": "1984"}}]}
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
await client.update_library()
|
|
154
|
+
|
|
155
|
+
card = client.library["12345"]
|
|
156
|
+
self.assertEqual(card.id, "12345")
|
|
157
|
+
self.assertEqual(card.title, "1984")
|
|
158
|
+
|
|
146
159
|
|
|
147
160
|
class MqttSurfaceTests(_ClientTestCase):
|
|
148
161
|
async def test_connect_events_passes_getter_reading_live_token(self) -> None:
|
|
@@ -346,20 +346,20 @@ class YotoClient:
|
|
|
346
346
|
token = await self.check_and_refresh_token()
|
|
347
347
|
response = await self._rest.get_card_library(token)
|
|
348
348
|
for item in response.get("cards", []):
|
|
349
|
-
card_id =
|
|
349
|
+
card_id = get_raw_value(item, "cardId")
|
|
350
350
|
if card_id is None:
|
|
351
351
|
continue
|
|
352
352
|
card = self.library.get(card_id)
|
|
353
353
|
if card is None:
|
|
354
354
|
card = Card(id=card_id)
|
|
355
355
|
self.library[card_id] = card
|
|
356
|
-
card.title =
|
|
357
|
-
card.description =
|
|
358
|
-
card.author =
|
|
359
|
-
card.category =
|
|
360
|
-
card.cover_image_large =
|
|
356
|
+
card.title = get_raw_value(item, "card.title")
|
|
357
|
+
card.description = get_raw_value(item, "card.metadata.description")
|
|
358
|
+
card.author = get_raw_value(item, "card.metadata.author")
|
|
359
|
+
card.category = get_raw_value(item, "card.metadata.category")
|
|
360
|
+
card.cover_image_large = get_raw_value(item, "card.metadata.cover.imageL")
|
|
361
361
|
card.series_order = get_child_value(item, "card.metadata.seriesorder")
|
|
362
|
-
card.series_title =
|
|
362
|
+
card.series_title = get_raw_value(item, "card.metadata.seriestitle")
|
|
363
363
|
|
|
364
364
|
async def update_card_detail(self, card_id: str) -> None:
|
|
365
365
|
"""GET /card/{cardId} — populate chapters/tracks on the card."""
|
|
@@ -377,8 +377,8 @@ class YotoClient:
|
|
|
377
377
|
if chapter is None:
|
|
378
378
|
chapter = Chapter(key=key)
|
|
379
379
|
card.chapters[key] = chapter
|
|
380
|
-
chapter.icon =
|
|
381
|
-
chapter.title =
|
|
380
|
+
chapter.icon = get_raw_value(chapter_item, "display.icon16x16")
|
|
381
|
+
chapter.title = get_raw_value(chapter_item, "title")
|
|
382
382
|
chapter.duration = get_child_value(chapter_item, "duration")
|
|
383
383
|
for track_item in chapter_item.get("tracks", []):
|
|
384
384
|
track_key = get_raw_value(track_item, "key")
|
|
@@ -387,13 +387,13 @@ class YotoClient:
|
|
|
387
387
|
if track_key not in chapter.tracks:
|
|
388
388
|
chapter.tracks[track_key] = Track(key=track_key)
|
|
389
389
|
track = chapter.tracks[track_key]
|
|
390
|
-
track.icon =
|
|
391
|
-
track.title =
|
|
390
|
+
track.icon = get_raw_value(track_item, "display.icon16x16")
|
|
391
|
+
track.title = get_raw_value(track_item, "title")
|
|
392
392
|
track.duration = get_child_value(track_item, "duration")
|
|
393
|
-
track.format =
|
|
394
|
-
track.channels =
|
|
395
|
-
track.type =
|
|
396
|
-
track.trackUrl =
|
|
393
|
+
track.format = get_raw_value(track_item, "format")
|
|
394
|
+
track.channels = get_raw_value(track_item, "channels")
|
|
395
|
+
track.type = get_raw_value(track_item, "type")
|
|
396
|
+
track.trackUrl = get_raw_value(track_item, "trackUrl")
|
|
397
397
|
|
|
398
398
|
async def update_groups(self) -> None:
|
|
399
399
|
"""GET /card/family/library/groups — populate self.groups.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|