From b14de3bcab0b7253c2a6c3e975b721dd9d1bc023 Mon Sep 17 00:00:00 2001 From: Nick Ninov Date: Mon, 17 Aug 2026 11:43:40 +0300 Subject: [PATCH] bug: status-bot implementation --- pyproject.toml | 2 +- status_sdk/account.py | 16 ++++------------ status_sdk/logger.py | 6 +++--- 3 files changed, 8 insertions(+), 16 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 2cc6d3b..f27fdc6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "status-sdk" -version = "1.1.1" +version = "1.1.2" description = "Private chat. Communities. Multi-chain wallet. Browser. dApps all in one app, powered by SNT." readme = "README.md" requires-python = ">=3.11" diff --git a/status_sdk/account.py b/status_sdk/account.py index f1aa627..3ccd869 100644 --- a/status_sdk/account.py +++ b/status_sdk/account.py @@ -1731,19 +1731,11 @@ class Account: if not isinstance(timestamp, str): raise exceptions.InvalidTimestampError(f"Expected a `str` or a `datetime.datetime`, got `{type(timestamp).__name__}`...") - # Accepted timestamp formats, tried from the most to the least precise - formats = [ - "%Y-%m-%d %H:%M:%S.%f", "%Y-%m-%d %H:%M:%S", - "%Y-%m-%d %H:%M", "%Y-%m-%d %H", "%Y-%m-%d" - ] - value = timestamp.strip().replace("T", " ") - for current_format in formats: - try: - return datetime.datetime.strptime(value, current_format) - except ValueError: - continue + try: + return datetime.datetime.fromisoformat(timestamp) + except: + raise exceptions.InvalidTimestampError(f"`{timestamp}` is not a valid timestamp... Please make sure the input is in ISO 8601 format (https://www.iso.org/iso-8601-date-and-time-format.html).") - raise exceptions.InvalidTimestampError(f"`{timestamp}` is not a valid timestamp. Supported formats: {', '.join(formats)}") def __validate_display_name(self, name: str): """ diff --git a/status_sdk/logger.py b/status_sdk/logger.py index 850b254..5ebc7d0 100644 --- a/status_sdk/logger.py +++ b/status_sdk/logger.py @@ -4,12 +4,12 @@ import logging class Logger: instance: Optional[logging.Logger] = None - def __new__(cls) -> logging.Logger: + def __new__(cls, name: str = "status-bot") -> logging.Logger: if cls.instance: - return cls.instance + return logging.getLogger(name) - cls.instance = logging.getLogger("status-bot") + cls.instance = logging.getLogger(name) cls.instance.setLevel(logging.INFO) cls.instance.propagate = False