pynintendoparental 1.0.4__tar.gz → 1.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 (25) hide show
  1. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/PKG-INFO +4 -4
  2. pynintendoparental-1.1.0/pynintendoparental/_version.py +1 -0
  3. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental/const.py +3 -3
  4. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental/device.py +14 -9
  5. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental/exceptions.py +16 -0
  6. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental.egg-info/PKG-INFO +4 -4
  7. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental.egg-info/requires.txt +3 -3
  8. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/setup.py +3 -3
  9. pynintendoparental-1.0.4/pynintendoparental/_version.py +0 -1
  10. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/LICENSE +0 -0
  11. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/README.md +0 -0
  12. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental/__init__.py +0 -0
  13. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental/api.py +0 -0
  14. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental/application.py +0 -0
  15. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental/authenticator/__init__.py +0 -0
  16. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental/authenticator/const.py +0 -0
  17. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental/enum.py +0 -0
  18. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental/player.py +0 -0
  19. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental/py.typed +0 -0
  20. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental/utils.py +0 -0
  21. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental.egg-info/SOURCES.txt +0 -0
  22. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental.egg-info/dependency_links.txt +0 -0
  23. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pynintendoparental.egg-info/top_level.txt +0 -0
  24. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/pyproject.toml +0 -0
  25. {pynintendoparental-1.0.4 → pynintendoparental-1.1.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pynintendoparental
3
- Version: 1.0.4
3
+ Version: 1.1.0
4
4
  Summary: A Python module to interact with Nintendo Parental Controls
5
5
  Home-page: http://github.com/pantherale0/pynintendoparental
6
6
  Author: pantherale0
@@ -14,12 +14,12 @@ License-File: LICENSE
14
14
  Provides-Extra: dev
15
15
  Requires-Dist: bandit<1.9,>=1.7; extra == "dev"
16
16
  Requires-Dist: black<26,>=23; extra == "dev"
17
- Requires-Dist: build<1.3,>=0.10; extra == "dev"
17
+ Requires-Dist: build<1.4,>=0.10; extra == "dev"
18
18
  Requires-Dist: flake8<8,>=6; extra == "dev"
19
19
  Requires-Dist: isort<7,>=5; extra == "dev"
20
- Requires-Dist: mypy<1.18,>=1.5; extra == "dev"
20
+ Requires-Dist: mypy<1.19,>=1.5; extra == "dev"
21
21
  Requires-Dist: pytest<9,>=7; extra == "dev"
22
- Requires-Dist: pytest-cov<7,>=4; extra == "dev"
22
+ Requires-Dist: pytest-cov<8,>=4; extra == "dev"
23
23
  Requires-Dist: twine<7,>=4; extra == "dev"
24
24
  Dynamic: author
25
25
  Dynamic: classifier
@@ -0,0 +1 @@
1
+ __version__ = "1.1.0"
@@ -5,10 +5,10 @@ import logging
5
5
 
6
6
  _LOGGER = logging.getLogger(__package__)
7
7
  MOBILE_APP_PKG = "com.nintendo.znma"
8
- MOBILE_APP_VERSION = "2.1.1"
9
- MOBILE_APP_BUILD = "540"
8
+ MOBILE_APP_VERSION = "2.2.0"
9
+ MOBILE_APP_BUILD = "560"
10
10
  OS_NAME = "ANDROID"
11
- OS_VERSION = "33"
11
+ OS_VERSION = "34"
12
12
  OS_STR = f"{OS_NAME} {OS_VERSION}"
13
13
  DEVICE_MODEL = "Pixel 4 XL"
14
14
  BASE_URL = "https://app.lp1.znma.srv.nintendo.net/v2"
@@ -8,7 +8,7 @@ from typing import Callable
8
8
 
9
9
  from .api import Api
10
10
  from .const import _LOGGER, DAYS_OF_WEEK
11
- from .exceptions import HttpException
11
+ from .exceptions import HttpException, BedtimeOutOfRangeError
12
12
  from .enum import AlarmSettingState, RestrictionMode
13
13
  from .player import Player
14
14
  from .utils import is_awaitable
@@ -121,20 +121,25 @@ class Device:
121
121
  self._parse_parental_control_setting(response["json"])
122
122
  await self._execute_callbacks()
123
123
 
124
- async def set_bedtime_alarm(self, end_time: time = None, enabled: bool = True):
124
+ async def set_bedtime_alarm(self, value: time):
125
125
  """Update the bedtime alarm for the device."""
126
- _LOGGER.debug(">> Device.set_bedtime_alarm(end_time=%s, enabled=%s)",
127
- end_time,
128
- enabled)
126
+ _LOGGER.debug(">> Device.set_bedtime_alarm(value=%s)",
127
+ value)
128
+ if not (
129
+ (16 <= value.hour <= 22) or
130
+ (value.hour == 23 and value.minute == 0) or
131
+ (value.hour == 0 and value.minute == 0)
132
+ ):
133
+ raise BedtimeOutOfRangeError(value=value)
129
134
  bedtime = {
130
- "enabled": enabled,
135
+ "enabled": value.hour != 0 and value.minute != 0,
131
136
  }
132
- if end_time is not None:
137
+ if bedtime["enabled"]:
133
138
  bedtime = {
134
139
  **bedtime,
135
140
  "endingTime": {
136
- "hour": end_time.hour,
137
- "minute": end_time.minute
141
+ "hour": value.hour,
142
+ "minute": value.minute
138
143
  }
139
144
  }
140
145
  if self.timer_mode == "DAILY":
@@ -1,5 +1,7 @@
1
1
  """Nintendo Parental exceptions."""
2
2
 
3
+ from datetime import time
4
+
3
5
  class HttpException(Exception):
4
6
  """A HTTP error occured"""
5
7
  def __init__(self, status_code: int, message: str) -> None:
@@ -19,3 +21,17 @@ class InvalidOAuthConfigurationException(HttpException):
19
21
 
20
22
  class NoDevicesFoundException(Exception):
21
23
  """No devices were found for the account."""
24
+
25
+ class InputValidationError(Exception):
26
+ """Input Validation Failed."""
27
+ value: object
28
+ error_key: str
29
+
30
+ class BedtimeOutOfRangeError(InputValidationError):
31
+ """Bedtime is outside of the allowed range."""
32
+
33
+ error_key = "bedtime_alarm_out_of_range"
34
+
35
+ def __init__(self, value: object) -> None:
36
+ super().__init__()
37
+ self.value = value
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pynintendoparental
3
- Version: 1.0.4
3
+ Version: 1.1.0
4
4
  Summary: A Python module to interact with Nintendo Parental Controls
5
5
  Home-page: http://github.com/pantherale0/pynintendoparental
6
6
  Author: pantherale0
@@ -14,12 +14,12 @@ License-File: LICENSE
14
14
  Provides-Extra: dev
15
15
  Requires-Dist: bandit<1.9,>=1.7; extra == "dev"
16
16
  Requires-Dist: black<26,>=23; extra == "dev"
17
- Requires-Dist: build<1.3,>=0.10; extra == "dev"
17
+ Requires-Dist: build<1.4,>=0.10; extra == "dev"
18
18
  Requires-Dist: flake8<8,>=6; extra == "dev"
19
19
  Requires-Dist: isort<7,>=5; extra == "dev"
20
- Requires-Dist: mypy<1.18,>=1.5; extra == "dev"
20
+ Requires-Dist: mypy<1.19,>=1.5; extra == "dev"
21
21
  Requires-Dist: pytest<9,>=7; extra == "dev"
22
- Requires-Dist: pytest-cov<7,>=4; extra == "dev"
22
+ Requires-Dist: pytest-cov<8,>=4; extra == "dev"
23
23
  Requires-Dist: twine<7,>=4; extra == "dev"
24
24
  Dynamic: author
25
25
  Dynamic: classifier
@@ -2,10 +2,10 @@
2
2
  [dev]
3
3
  bandit<1.9,>=1.7
4
4
  black<26,>=23
5
- build<1.3,>=0.10
5
+ build<1.4,>=0.10
6
6
  flake8<8,>=6
7
7
  isort<7,>=5
8
- mypy<1.18,>=1.5
8
+ mypy<1.19,>=1.5
9
9
  pytest<9,>=7
10
- pytest-cov<7,>=4
10
+ pytest-cov<8,>=4
11
11
  twine<7,>=4
@@ -21,12 +21,12 @@ REQUIREMENTS = [
21
21
  DEV_REQUIREMENTS = [
22
22
  'bandit >= 1.7,< 1.9',
23
23
  'black >= 23,< 26',
24
- 'build >= 0.10,< 1.3',
24
+ 'build >= 0.10,< 1.4',
25
25
  'flake8 >= 6,< 8',
26
26
  'isort >= 5,< 7',
27
- 'mypy >= 1.5,< 1.18',
27
+ 'mypy >= 1.5,< 1.19',
28
28
  'pytest >= 7,< 9',
29
- 'pytest-cov >= 4,< 7',
29
+ 'pytest-cov >= 4,< 8',
30
30
  'twine >= 4,< 7',
31
31
  ]
32
32
 
@@ -1 +0,0 @@
1
- __version__ = "1.0.4"