otf-api 0.14.0__tar.gz → 0.14.1__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.
- {otf_api-0.14.0/src/otf_api.egg-info → otf_api-0.14.1}/PKG-INFO +1 -1
- {otf_api-0.14.0 → otf_api-0.14.1}/pyproject.toml +1 -1
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/__init__.py +1 -1
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/auth/auth.py +14 -21
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/cache.py +10 -0
- {otf_api-0.14.0 → otf_api-0.14.1/src/otf_api.egg-info}/PKG-INFO +1 -1
- {otf_api-0.14.0 → otf_api-0.14.1}/LICENSE +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/README.md +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/setup.cfg +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/__init__.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/_compat.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/api.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/bookings/__init__.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/bookings/booking_api.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/bookings/booking_client.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/client.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/members/__init__.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/members/member_api.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/members/member_client.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/studios/__init__.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/studios/studio_api.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/studios/studio_client.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/utils.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/workouts/__init__.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/workouts/workout_api.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/api/workouts/workout_client.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/auth/__init__.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/auth/user.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/auth/utils.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/exceptions.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/__init__.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/base.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/bookings/__init__.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/bookings/bookings.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/bookings/bookings_v2.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/bookings/classes.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/bookings/enums.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/bookings/filters.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/bookings/ratings.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/members/__init__.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/members/member_detail.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/members/member_membership.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/members/member_purchases.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/members/notifications.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/mixins.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/studios/__init__.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/studios/enums.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/studios/studio_detail.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/studios/studio_services.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/workouts/__init__.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/workouts/body_composition_list.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/workouts/challenge_tracker_content.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/workouts/challenge_tracker_detail.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/workouts/enums.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/workouts/lifetime_stats.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/workouts/out_of_studio_workout_history.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/workouts/performance_summary.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/workouts/telemetry.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/workouts/workout.py +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/py.typed +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api.egg-info/SOURCES.txt +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api.egg-info/dependency_links.txt +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api.egg-info/requires.txt +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api.egg-info/top_level.txt +0 -0
- {otf_api-0.14.0 → otf_api-0.14.1}/tests/test_filters.py +0 -0
@@ -3,6 +3,7 @@ import platform
|
|
3
3
|
import typing
|
4
4
|
from collections.abc import Generator
|
5
5
|
from datetime import datetime
|
6
|
+
from functools import lru_cache
|
6
7
|
from logging import getLogger
|
7
8
|
from time import sleep
|
8
9
|
from typing import Any, ClassVar
|
@@ -119,15 +120,21 @@ class OtfCognito(Cognito):
|
|
119
120
|
self.mfa_tokens: dict[str, Any] = {}
|
120
121
|
self.pool_domain_url: str | None = None
|
121
122
|
|
122
|
-
self.
|
123
|
-
"cognito-idp", config=BOTO_CONFIG, region_name=REGION
|
124
|
-
) # type: ignore
|
123
|
+
self.handle_login(password)
|
125
124
|
|
126
|
-
|
127
|
-
|
128
|
-
|
125
|
+
@property
|
126
|
+
@lru_cache(maxsize=1)
|
127
|
+
def idp_client(self) -> "CognitoIdentityProviderClient":
|
128
|
+
"""Returns the Cognito Identity Provider client."""
|
129
|
+
LOGGER.debug("Creating Cognito Identity Provider client")
|
130
|
+
return Session().client("cognito-idp", config=BOTO_CONFIG, region_name=REGION) # type: ignore
|
129
131
|
|
130
|
-
|
132
|
+
@property
|
133
|
+
@lru_cache(maxsize=1)
|
134
|
+
def id_client(self) -> "CognitoIdentityClient":
|
135
|
+
"""Returns the Cognito Identity client."""
|
136
|
+
LOGGER.debug("Creating Cognito Identity client")
|
137
|
+
return Session().client("cognito-identity", config=BOTO_CONFIG, region_name=REGION) # type: ignore
|
131
138
|
|
132
139
|
def handle_login(self, password: str | None = None) -> None:
|
133
140
|
"""Handles the login process for the user.
|
@@ -340,20 +347,6 @@ class OtfCognito(Cognito):
|
|
340
347
|
self.device_group_key = device_metadata.get("DeviceGroupKey", self.device_group_key)
|
341
348
|
CACHE.write_device_data_to_cache(self.device_metadata)
|
342
349
|
|
343
|
-
def __getstate__(self):
|
344
|
-
"""Get the state of the object for pickling."""
|
345
|
-
state = self.__dict__.copy()
|
346
|
-
del state["idp_client"]
|
347
|
-
del state["id_client"]
|
348
|
-
return state
|
349
|
-
|
350
|
-
def __setstate__(self, state): # noqa
|
351
|
-
"""Set the state of the object from a pickled state."""
|
352
|
-
self.__dict__.update(state)
|
353
|
-
self.idp_client = Session().client("cognito-idp", config=BOTO_CONFIG, region_name=REGION) # type: ignore
|
354
|
-
|
355
|
-
self.id_client = Session().client("cognito-identity", config=BOTO_CONFIG, region_name=REGION) # type: ignore
|
356
|
-
|
357
350
|
|
358
351
|
class HttpxCognitoAuth(httpx.Auth):
|
359
352
|
http_header: str = "Authorization"
|
@@ -130,3 +130,13 @@ def get_cache() -> OtfCache:
|
|
130
130
|
LOGGER.debug("Using cache directory: %s", cache_dir)
|
131
131
|
_CACHE = OtfCache(cache_dir)
|
132
132
|
return _CACHE
|
133
|
+
|
134
|
+
|
135
|
+
def clear_cache() -> None:
|
136
|
+
"""Clears the cache."""
|
137
|
+
try:
|
138
|
+
cache = get_cache()
|
139
|
+
cache.clear_device_data()
|
140
|
+
cache.clear_tokens()
|
141
|
+
except Exception:
|
142
|
+
LOGGER.exception("Failed to clear cache")
|
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
|
{otf_api-0.14.0 → otf_api-0.14.1}/src/otf_api/models/workouts/out_of_studio_workout_history.py
RENAMED
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
|