mirror of
https://github.com/status-im/status-python-sdk.git
synced 2026-08-30 21:51:14 +00:00
bug: status-bot implementation
This commit is contained in:
+1
-1
@@ -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"
|
||||
|
||||
+4
-12
@@ -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):
|
||||
"""
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user