adventuresinodyssey 0.1.4__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.
@@ -0,0 +1,54 @@
1
+ Metadata-Version: 2.4
2
+ Name: adventuresinodyssey
3
+ Version: 0.1.4
4
+ Summary: Python API client for the Adventures in Odyssey Club and public endpoints.
5
+ Author-email: CATEIN <CATEIN@protonmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/CATEIN/adventuresinodyssey-py
8
+ Project-URL: Repository, https://github.com/CATEIN/adventuresinodyssey-py
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Topic :: Internet :: WWW/HTTP
13
+ Requires-Python: >=3.8
14
+ Description-Content-Type: text/markdown
15
+ Requires-Dist: requests>=2.28.1
16
+ Requires-Dist: playwright>=1.40.0
17
+
18
+ An unofficial Python API client for the Adventures in Odyssey Club and public endpoints. This library allows you to interact with AIO content, including retrieving metadata for albums and episodes.
19
+
20
+ **Note:** This is an Alpha release. APIs may change.
21
+
22
+ [Documentation](https://github.com/CATEIN/adventuresinodyssey-py/blob/main/docs/docs.md)
23
+
24
+ [Github](https://github.com/CATEIN/adventuresinodyssey-py)
25
+
26
+ ### Important: Browser Requirement
27
+
28
+ This library uses Playwright for authentication. After installing the package, you must install the required browser binaries (Chromium):
29
+
30
+ ```bash
31
+ playwright install chromium
32
+ ```
33
+
34
+ ## Example Program
35
+ ```python
36
+ import random
37
+ from adventuresinodyssey import AIOClient
38
+
39
+ client = AIOClient()
40
+ link_base = "https://app.adventuresinodyssey.com/content/"
41
+
42
+ print("Caching episodes...")
43
+ all_episodes = client.cache_episodes()
44
+
45
+ if not all_episodes:
46
+ print("Error: Failed to cache episodes.")
47
+ exit()
48
+
49
+ # Pick a random episode
50
+ episode = random.choice(all_episodes)
51
+
52
+ print(f"Random episode: {episode.get('short_name')}")
53
+ print(f"Link: {link_base}{episode.get('id')}")
54
+ ```
@@ -0,0 +1,37 @@
1
+ An unofficial Python API client for the Adventures in Odyssey Club and public endpoints. This library allows you to interact with AIO content, including retrieving metadata for albums and episodes.
2
+
3
+ **Note:** This is an Alpha release. APIs may change.
4
+
5
+ [Documentation](https://github.com/CATEIN/adventuresinodyssey-py/blob/main/docs/docs.md)
6
+
7
+ [Github](https://github.com/CATEIN/adventuresinodyssey-py)
8
+
9
+ ### Important: Browser Requirement
10
+
11
+ This library uses Playwright for authentication. After installing the package, you must install the required browser binaries (Chromium):
12
+
13
+ ```bash
14
+ playwright install chromium
15
+ ```
16
+
17
+ ## Example Program
18
+ ```python
19
+ import random
20
+ from adventuresinodyssey import AIOClient
21
+
22
+ client = AIOClient()
23
+ link_base = "https://app.adventuresinodyssey.com/content/"
24
+
25
+ print("Caching episodes...")
26
+ all_episodes = client.cache_episodes()
27
+
28
+ if not all_episodes:
29
+ print("Error: Failed to cache episodes.")
30
+ exit()
31
+
32
+ # Pick a random episode
33
+ episode = random.choice(all_episodes)
34
+
35
+ print(f"Random episode: {episode.get('short_name')}")
36
+ print(f"Link: {link_base}{episode.get('id')}")
37
+ ```
@@ -0,0 +1,31 @@
1
+ """
2
+ Adventures in Odyssey API Package
3
+ """
4
+ from .clubclient import ClubClient
5
+ from .aioclient import AIOClient
6
+
7
+ __version__ = "0.1.4"
8
+ __all__ = ["ClubClient", "AIOClient"]
9
+
10
+ import logging
11
+
12
+ def set_logging_level(level: str = 'INFO'):
13
+ """
14
+ Sets the logging level for the 'adventuresinodyssey' package and its modules.
15
+
16
+ Args:
17
+ level: The desired logging level (e.g., 'DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL').
18
+ """
19
+ # 1. Map string level to logging constants
20
+ numeric_level = getattr(logging, level.upper(), None)
21
+ if not isinstance(numeric_level, int):
22
+ raise ValueError(f"Invalid logging level: {level}. Must be one of DEBUG, INFO, WARNING, ERROR, CRITICAL.")
23
+
24
+ # 2. Get the root logger for the entire package ('adventuresinodyssey')
25
+ package_logger = logging.getLogger('adventuresinodyssey')
26
+ package_logger.setLevel(numeric_level)
27
+
28
+ # 3. If a handler hasn't been configured (i.e., the user hasn't called basicConfig),
29
+ # ensure logging output goes somewhere by attaching a basic handler.
30
+ if not logging.root.handlers:
31
+ logging.basicConfig(level=numeric_level)