Skip to content

Commit

Permalink
🐛 v2.10.1-1298 (#123)
Browse files Browse the repository at this point in the history
Signed-off-by: Ludy87 <[email protected]>
  • Loading branch information
Ludy87 authored Oct 6, 2023
1 parent ca2667a commit 1d1c01b
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 19 deletions.
2 changes: 1 addition & 1 deletion src/pyxplora_api/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
ENDPOINT = "https://api.myxplora.com/api"
DEFAULT_TIMEOUT = 60
DEFAULT_USER_AGENT = (
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36"
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36"
)
2 changes: 1 addition & 1 deletion src/pyxplora_api/const_version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
VERSION = "2.10.0"
VERSION = "2.10.1"
VERSION_APP = "1298"
2 changes: 0 additions & 2 deletions src/pyxplora_api/exception_classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class ErrorMSG(Enum):
class Error(Exception):
"""Base class for all Exceptions."""

pass


class NoAdminError(Error):
"""Exception raised when a user is not an administrator."""
Expand Down
3 changes: 2 additions & 1 deletion src/pyxplora_api/graphql_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def __init__(self, endpoint: str, headers: dict[str, str] = {}, **kwargs: any):
self.headers = headers
self.options = kwargs

def __request_body(self, query: str, variables: dict[str, any] = None, operation_name: str = None) -> dict[str, any]:
@staticmethod
def __request_body(query: str, variables: dict[str, any] = None, operation_name: str = None) -> dict[str, any]:
json: dict[str, any] = {"query": query}

if variables:
Expand Down
5 changes: 0 additions & 5 deletions src/pyxplora_api/handler_gql.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ class HandlerGQL:
_API_SECRET (str): The API secret.
issueToken (dict[str, any]): The issue token.
errors (list[any]): A list of errors.
"""

accessToken: any = None # noqa: N815
Expand Down Expand Up @@ -54,7 +53,6 @@ def __init__(
timeZone (str): The time zone.
email (str, optional): The email address. Defaults to None.
signup (bool, optional): Indicates if the user is signing up. Defaults to True.
"""
# init vars
self.userLocale = userLang
Expand All @@ -81,7 +79,6 @@ def getApiKey(self):
Returns:
str: The API key.
"""
return self._API_KEY

Expand All @@ -90,7 +87,6 @@ def getSecret(self):
Returns:
str: The API secret.
"""
return self._API_SECRET

Expand All @@ -105,7 +101,6 @@ def getRequestHeaders(self, acceptedContentType: str) -> dict[str, any]:
Raises:
Exception: If `acceptedContentType` is empty or if `API_KEY` or `API_SECRET` is not set.
"""
if acceptedContentType == "" or acceptedContentType is None:
raise Exception("acceptedContentType MUST NOT be empty!")
Expand Down
11 changes: 4 additions & 7 deletions src/pyxplora_api/pyxplora.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def _hasTokenExpired(self) -> bool:
"""
return (int(time()) - self.dtIssueToken) > (self.tokenExpiresAfter * 1000)

def delay(self, duration_in_seconds):
@staticmethod
def delay(duration_in_seconds):
"""Delay the execution for a specified duration.
Args:
Expand Down Expand Up @@ -183,7 +184,6 @@ def getUserUpdate(self) -> str:
Returns:
str: The user update time in the format 'YYYY-MM-DD HH:MM:SS'.
"""
return datetime.fromtimestamp(self.user.get("update", 0.0)).strftime("%Y-%m-%d %H:%M:%S")

Expand All @@ -197,7 +197,6 @@ def getWatchUserIDs(self, watch_user_phone_numbers: list[str] | None = None) ->
Returns:
list[str]: A list of unique identifiers of the watch users.
"""
if isinstance(self._wuid, list) and self._wuid:
return self._wuid
Expand Down Expand Up @@ -227,7 +226,6 @@ def getWatchUserPhoneNumbers(self, wuid: str | list[str] | None = None, ignoreEr
Raises:
ChildNoError: If no `wuid` provided or watch user ids are not found.
XTypeError: If the `wuid` is not of type `str` or `list[str]`.
"""
watchuserphonenumbers = []
if wuid is None:
Expand Down Expand Up @@ -265,7 +263,6 @@ def getWatchUserNames(self, wuid: str | list[str] | None = None) -> str | list[s
Raises:
ChildNoError: If the user IDs are not found.
XTypeError: If the `wuid` parameter is not a string or a list of strings.
"""
watchusernames = []
if wuid is None:
Expand Down Expand Up @@ -298,7 +295,6 @@ def getWatchUserIcons(self, wuid: str | list[str] | None | None = None) -> str |
Raises:
ChildNoError: If no watch user ID is found.
XTypeError: If the input argument is not of type 'str' or 'list[str]'.
"""
watch_user_icons = []
if wuid is None:
Expand Down Expand Up @@ -414,7 +410,8 @@ def getWatchUserTotalStep(self, wuid: str | list[str] | None | None = None) -> i
return watchusertotalstep

##### - #####
def _helperTime(self, t: str) -> str:
@staticmethod
def _helperTime(t: str) -> str:
"""Convert time in minutes to hours and minutes.
Args:
Expand Down
3 changes: 2 additions & 1 deletion src/pyxplora_api/pyxplora_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ def init(self, forceLogin: bool = False, signup: bool = True) -> None:

self.user = user

def version(self) -> str:
@staticmethod
def version() -> str:
return f"{VERSION}-{VERSION_APP}"

def setDevices(self, ids: str | list[str] | None = None) -> list[str]:
Expand Down
3 changes: 2 additions & 1 deletion src/pyxplora_api/pyxplora_api_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ async def init(self, forceLogin: bool = False, signup: bool = True, key=None, se
self.watchs = [watch for watch in children if watch["ward"]["phoneNumber"] in self._childPhoneNumber]
self.user = user

def version(self) -> str:
@staticmethod
def version() -> str:
return f"{VERSION}-{VERSION_APP}"

async def setDevices(self, ids: str | list[str] | None = None) -> list[str]:
Expand Down

0 comments on commit 1d1c01b

Please sign in to comment.