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.
Files changed (22) hide show
  1. {init_data_py-0.2.2 → init_data_py-0.2.4}/PKG-INFO +1 -1
  2. {init_data_py-0.2.2 → init_data_py-0.2.4}/pyproject.toml +1 -1
  3. {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/__init__.py +1 -1
  4. {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/errors/errors.py +9 -5
  5. {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/init_data.py +1 -3
  6. {init_data_py-0.2.2 → init_data_py-0.2.4}/.github/workflows/publish.yml +0 -0
  7. {init_data_py-0.2.2 → init_data_py-0.2.4}/.gitignore +0 -0
  8. {init_data_py-0.2.2 → init_data_py-0.2.4}/.python-version +0 -0
  9. {init_data_py-0.2.2 → init_data_py-0.2.4}/LICENCE +0 -0
  10. {init_data_py-0.2.2 → init_data_py-0.2.4}/README.md +0 -0
  11. {init_data_py-0.2.2 → init_data_py-0.2.4}/requirements-dev.lock +0 -0
  12. {init_data_py-0.2.2 → init_data_py-0.2.4}/requirements.lock +0 -0
  13. {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/errors/__init__.py +0 -0
  14. {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/types/__init__.py +0 -0
  15. {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/types/chat.py +0 -0
  16. {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/types/object.py +0 -0
  17. {init_data_py-0.2.2 → init_data_py-0.2.4}/src/init_data_py/types/user.py +0 -0
  18. {init_data_py-0.2.2 → init_data_py-0.2.4}/tests/__init__.py +0 -0
  19. {init_data_py-0.2.2 → init_data_py-0.2.4}/tests/test_parse.py +0 -0
  20. {init_data_py-0.2.2 → init_data_py-0.2.4}/tests/test_sign.py +0 -0
  21. {init_data_py-0.2.2 → init_data_py-0.2.4}/tests/test_to_query_string.py +0 -0
  22. {init_data_py-0.2.2 → init_data_py-0.2.4}/tests/test_validate.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: init-data-py
3
- Version: 0.2.2
3
+ Version: 0.2.4
4
4
  Summary: A Python library that provides tools for using and validating Telegram web app init data.
5
5
  Author-email: nimaxin <nimaxin@proton.me>
6
6
  License-Expression: MIT
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "init-data-py"
3
- version = "0.2.2"
3
+ version = "0.2.4"
4
4
  description = "A Python library that provides tools for using and validating Telegram web app init data."
5
5
  authors = [
6
6
  { name = "nimaxin", email = "nimaxin@proton.me" }
@@ -1,5 +1,5 @@
1
1
  from .init_data import InitData
2
2
 
3
- __version__ = "0.2.2"
3
+ __version__ = "0.2.4"
4
4
 
5
5
  __all__ = ["InitData"]
@@ -1,23 +1,27 @@
1
- class AuthDateMissingError(Exception):
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(Exception):
10
+ class ExpiredError(InitDataPyError):
7
11
  def __init__(self):
8
12
  super().__init__("init data is expired.")
9
13
 
10
14
 
11
- class SignInvalidError(Exception):
15
+ class SignInvalidError(InitDataPyError):
12
16
  def __init__(self):
13
17
  super().__init__("signature (hash) is invalid.")
14
18
 
15
19
 
16
- class SignMissingError(Exception):
20
+ class SignMissingError(InitDataPyError):
17
21
  def __init__(self):
18
22
  super().__init__("signature (hash) is missing.")
19
23
 
20
24
 
21
- class UnexpectedFormatError(Exception):
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