init-data-py 0.2.2__tar.gz → 0.2.4__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.
- {init_data_py-0.2.2 → init_data_py-0.2.4}/PKG-INFO +1 -1
- {init_data_py-0.2.2 → init_data_py-0.2.4}/pyproject.toml +1 -1
- {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/__init__.py +1 -1
- {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/errors/errors.py +9 -5
- {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/init_data.py +1 -3
- {init_data_py-0.2.2 → init_data_py-0.2.4}/.github/workflows/publish.yml +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/.gitignore +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/.python-version +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/LICENCE +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/README.md +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/requirements-dev.lock +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/requirements.lock +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/errors/__init__.py +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/types/__init__.py +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/types/chat.py +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/types/object.py +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/types/user.py +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/tests/__init__.py +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/tests/test_parse.py +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/tests/test_sign.py +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/tests/test_to_query_string.py +0 -0
- {init_data_py-0.2.2 → init_data_py-0.2.4}/tests/test_validate.py +0 -0
|
@@ -1,23 +1,27 @@
|
|
|
1
|
-
class
|
|
1
|
+
class InitDataPyError(Exception):
|
|
2
|
+
pass
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class AuthDateMissingError(InitDataPyError):
|
|
2
6
|
def __init__(self):
|
|
3
7
|
super().__init__("auth_date is missing.")
|
|
4
8
|
|
|
5
9
|
|
|
6
|
-
class ExpiredError(
|
|
10
|
+
class ExpiredError(InitDataPyError):
|
|
7
11
|
def __init__(self):
|
|
8
12
|
super().__init__("init data is expired.")
|
|
9
13
|
|
|
10
14
|
|
|
11
|
-
class SignInvalidError(
|
|
15
|
+
class SignInvalidError(InitDataPyError):
|
|
12
16
|
def __init__(self):
|
|
13
17
|
super().__init__("signature (hash) is invalid.")
|
|
14
18
|
|
|
15
19
|
|
|
16
|
-
class SignMissingError(
|
|
20
|
+
class SignMissingError(InitDataPyError):
|
|
17
21
|
def __init__(self):
|
|
18
22
|
super().__init__("signature (hash) is missing.")
|
|
19
23
|
|
|
20
24
|
|
|
21
|
-
class UnexpectedFormatError(
|
|
25
|
+
class UnexpectedFormatError(InitDataPyError):
|
|
22
26
|
def __init__(self):
|
|
23
27
|
super().__init__("the init data query string has unexpected format.")
|
|
@@ -140,9 +140,7 @@ class InitData:
|
|
|
140
140
|
`InitData`:
|
|
141
141
|
This current updated init data by setting the `auth_date` and generated signature (`hash`) attributes.
|
|
142
142
|
"""
|
|
143
|
-
if auth_date is None
|
|
144
|
-
self.auth_date = int(time.time())
|
|
145
|
-
self.auth_date = auth_date
|
|
143
|
+
self.auth_date = auth_date if auth_date is not None else int(time.time())
|
|
146
144
|
self.hash = self.calculate_hash(bot_token)
|
|
147
145
|
|
|
148
146
|
return self
|
|
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
|