pytonapi 2.1.0__tar.gz → 2.2.1__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 (83) hide show
  1. {pytonapi-2.1.0/pytonapi.egg-info → pytonapi-2.2.1}/PKG-INFO +24 -6
  2. {pytonapi-2.1.0 → pytonapi-2.2.1}/README.md +12 -5
  3. {pytonapi-2.1.0 → pytonapi-2.2.1}/pyproject.toml +20 -3
  4. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/__meta__.py +1 -1
  5. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/client.py +12 -0
  6. pytonapi-2.2.1/pytonapi/streaming/__init__.py +35 -0
  7. pytonapi-2.2.1/pytonapi/streaming/base.py +492 -0
  8. pytonapi-2.2.1/pytonapi/streaming/models.py +196 -0
  9. pytonapi-2.2.1/pytonapi/streaming/sse.py +159 -0
  10. pytonapi-2.2.1/pytonapi/streaming/ws.py +282 -0
  11. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/webhook/dispatcher.py +42 -32
  12. {pytonapi-2.1.0 → pytonapi-2.2.1/pytonapi.egg-info}/PKG-INFO +24 -6
  13. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi.egg-info/SOURCES.txt +2 -1
  14. pytonapi-2.2.1/pytonapi.egg-info/requires.txt +13 -0
  15. pytonapi-2.2.1/tests/test_client.py +32 -0
  16. pytonapi-2.1.0/pytonapi/streaming/__init__.py +0 -19
  17. pytonapi-2.1.0/pytonapi/streaming/client.py +0 -95
  18. pytonapi-2.1.0/pytonapi/streaming/models.py +0 -33
  19. pytonapi-2.1.0/pytonapi/streaming/sse.py +0 -254
  20. pytonapi-2.1.0/pytonapi/streaming/ws.py +0 -229
  21. pytonapi-2.1.0/pytonapi.egg-info/requires.txt +0 -2
  22. {pytonapi-2.1.0 → pytonapi-2.2.1}/LICENSE +0 -0
  23. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/__init__.py +0 -0
  24. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/cli.py +0 -0
  25. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/exceptions.py +1 -1
  26. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/py.typed +0 -0
  27. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/__init__.py +0 -0
  28. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/client.py +0 -0
  29. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/limiter.py +0 -0
  30. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/mixin.py +0 -0
  31. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/__init__.py +0 -0
  32. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/_enums.py +0 -0
  33. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/accounts.py +0 -0
  34. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/blockchain.py +0 -0
  35. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/connect.py +0 -0
  36. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/dns.py +0 -0
  37. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/emulation.py +0 -0
  38. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/events.py +0 -0
  39. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/extra_currency.py +0 -0
  40. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/gasless.py +0 -0
  41. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/jettons.py +0 -0
  42. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/lite_server.py +0 -0
  43. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/multisig.py +0 -0
  44. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/nft.py +0 -0
  45. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/purchases.py +0 -0
  46. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/rates.py +0 -0
  47. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/staking.py +0 -0
  48. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/storage.py +0 -0
  49. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/traces.py +0 -0
  50. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/utilities.py +0 -0
  51. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/wallet.py +0 -0
  52. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/__init__.py +0 -0
  53. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/_base.py +0 -0
  54. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/accounts.py +0 -0
  55. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/blockchain.py +0 -0
  56. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/connect.py +0 -0
  57. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/dns.py +0 -0
  58. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/emulation.py +0 -0
  59. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/events.py +0 -0
  60. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/extra_currency.py +0 -0
  61. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/gasless.py +0 -0
  62. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/jettons.py +0 -0
  63. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/lite_server.py +0 -0
  64. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/multisig.py +0 -0
  65. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/nft.py +0 -0
  66. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/purchases.py +0 -0
  67. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/rates.py +0 -0
  68. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/staking.py +0 -0
  69. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/storage.py +0 -0
  70. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/traces.py +0 -0
  71. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/utilities.py +0 -0
  72. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/wallet.py +0 -0
  73. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/rotator.py +0 -0
  74. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/types.py +0 -0
  75. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/utils.py +0 -0
  76. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/webhook/__init__.py +0 -0
  77. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/webhook/client.py +0 -0
  78. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/webhook/models.py +0 -0
  79. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi.egg-info/dependency_links.txt +0 -0
  80. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi.egg-info/entry_points.txt +0 -0
  81. {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi.egg-info/top_level.txt +0 -0
  82. {pytonapi-2.1.0 → pytonapi-2.2.1}/setup.cfg +0 -0
  83. {pytonapi-2.1.0 → pytonapi-2.2.1}/tests/test_utils.py +0 -0
@@ -1,12 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pytonapi
3
- Version: 2.1.0
3
+ Version: 2.2.1
4
4
  Summary: Python SDK for TONAPI — REST API, streaming, and webhooks for TON blockchain.
5
5
  Author: nessshon
6
6
  Maintainer: nessshon
7
7
  License-Expression: MIT
8
8
  Project-URL: Homepage, https://github.com/nessshon/tonapi/
9
9
  Project-URL: Examples, https://github.com/nessshon/tonapi/tree/main/examples/
10
+ Project-URL: Documentation, https://tonapi.ness.su/
10
11
  Keywords: AsyncIO,REST API,SDK,TON,TON blockchain,TONAPI,The Open Network,blockchain,crypto,streaming,webhooks
11
12
  Classifier: Development Status :: 4 - Beta
12
13
  Classifier: Environment :: Console
@@ -25,6 +26,16 @@ Description-Content-Type: text/markdown
25
26
  License-File: LICENSE
26
27
  Requires-Dist: aiohttp>=3.9.0
27
28
  Requires-Dist: pydantic<3.0,>=2.0
29
+ Provides-Extra: dev
30
+ Requires-Dist: environs>=11.0.0; extra == "dev"
31
+ Requires-Dist: fastapi>=0.115.0; extra == "dev"
32
+ Requires-Dist: jinja2>=3.1; extra == "dev"
33
+ Requires-Dist: mypy>=1.19.0; extra == "dev"
34
+ Requires-Dist: pyyaml>=6.0; extra == "dev"
35
+ Requires-Dist: pytest>=8.0; extra == "dev"
36
+ Requires-Dist: pytest-asyncio>=0.24; extra == "dev"
37
+ Requires-Dist: ruff>=0.8.0; extra == "dev"
38
+ Requires-Dist: uvicorn>=0.34.0; extra == "dev"
28
39
  Dynamic: license-file
29
40
 
30
41
  # 📦 TON API
@@ -40,6 +51,7 @@ Dynamic: license-file
40
51
  ![Downloads](https://pepy.tech/badge/pytonapi)
41
52
  ![Downloads](https://pepy.tech/badge/pytonapi/month)
42
53
  ![Downloads](https://pepy.tech/badge/pytonapi/week)
54
+ [![Context7](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fcontext7.com%2Fapi%2Fv2%2Flibs%2Fsearch%3FlibraryName%3Dnessshon%2Ftonapi%26query%3Dtonapi&query=%24.results%5B0%5D.benchmarkScore&label=Context7&suffix=%2F100&color=blue)](https://context7.com/nessshon/tonapi)
43
55
 
44
56
  ### Python SDK for [TON API](https://tonapi.io)
45
57
 
@@ -80,9 +92,20 @@ pip install pytonapi
80
92
 
81
93
  - [Get account info](https://github.com/nessshon/tonapi/blob/main/examples/get_account_info.py)
82
94
  - [Get account transactions](https://github.com/nessshon/tonapi/blob/main/examples/get_account_transactions.py)
95
+ - [Get jetton info](https://github.com/nessshon/tonapi/blob/main/examples/get_jetton_info.py)
83
96
  - [Get NFTs by owner](https://github.com/nessshon/tonapi/blob/main/examples/get_nft_by_owner.py)
84
97
  - [Get NFTs by collection](https://github.com/nessshon/tonapi/blob/main/examples/get_nft_by_collection.py)
85
98
 
99
+ **Emulation & Sending**
100
+
101
+ - [Send message](https://github.com/nessshon/tonapi/blob/main/examples/send_message.py)
102
+ - [Emulate message](https://github.com/nessshon/tonapi/blob/main/examples/emulate_message.py)
103
+
104
+ **Transfers** (requires [tonutils](https://github.com/nessshon/tonutils))
105
+
106
+ - [Transfer TON](https://github.com/nessshon/tonapi/blob/main/examples/transfer_ton.py)
107
+ - [Gasless transfer](https://github.com/nessshon/tonapi/blob/main/examples/transfer_gasless.py)
108
+
86
109
  **Streaming** (SSE & WebSocket)
87
110
 
88
111
  - [SSE subscriptions](https://github.com/nessshon/tonapi/blob/main/examples/streaming_sse.py)
@@ -93,11 +116,6 @@ pip install pytonapi
93
116
  - [FastAPI webhook server](https://github.com/nessshon/tonapi/blob/main/examples/webhook_fastapi.py)
94
117
  - [aiohttp webhook server](https://github.com/nessshon/tonapi/blob/main/examples/webhook_aiohttp.py)
95
118
 
96
- **Transfers** (requires [tonutils](https://github.com/nessshon/tonutils))
97
-
98
- - [Transfer TON](https://github.com/nessshon/tonapi/blob/main/examples/transfer_ton.py)
99
- - [Gasless transfer](https://github.com/nessshon/tonapi/blob/main/examples/transfer_gasless.py)
100
-
101
119
  ## License
102
120
 
103
121
  This repository is distributed under the [MIT License](https://github.com/nessshon/tonapi/blob/main/LICENSE).
@@ -11,6 +11,7 @@
11
11
  ![Downloads](https://pepy.tech/badge/pytonapi)
12
12
  ![Downloads](https://pepy.tech/badge/pytonapi/month)
13
13
  ![Downloads](https://pepy.tech/badge/pytonapi/week)
14
+ [![Context7](https://img.shields.io/badge/dynamic/json?url=https%3A%2F%2Fcontext7.com%2Fapi%2Fv2%2Flibs%2Fsearch%3FlibraryName%3Dnessshon%2Ftonapi%26query%3Dtonapi&query=%24.results%5B0%5D.benchmarkScore&label=Context7&suffix=%2F100&color=blue)](https://context7.com/nessshon/tonapi)
14
15
 
15
16
  ### Python SDK for [TON API](https://tonapi.io)
16
17
 
@@ -51,9 +52,20 @@ pip install pytonapi
51
52
 
52
53
  - [Get account info](https://github.com/nessshon/tonapi/blob/main/examples/get_account_info.py)
53
54
  - [Get account transactions](https://github.com/nessshon/tonapi/blob/main/examples/get_account_transactions.py)
55
+ - [Get jetton info](https://github.com/nessshon/tonapi/blob/main/examples/get_jetton_info.py)
54
56
  - [Get NFTs by owner](https://github.com/nessshon/tonapi/blob/main/examples/get_nft_by_owner.py)
55
57
  - [Get NFTs by collection](https://github.com/nessshon/tonapi/blob/main/examples/get_nft_by_collection.py)
56
58
 
59
+ **Emulation & Sending**
60
+
61
+ - [Send message](https://github.com/nessshon/tonapi/blob/main/examples/send_message.py)
62
+ - [Emulate message](https://github.com/nessshon/tonapi/blob/main/examples/emulate_message.py)
63
+
64
+ **Transfers** (requires [tonutils](https://github.com/nessshon/tonutils))
65
+
66
+ - [Transfer TON](https://github.com/nessshon/tonapi/blob/main/examples/transfer_ton.py)
67
+ - [Gasless transfer](https://github.com/nessshon/tonapi/blob/main/examples/transfer_gasless.py)
68
+
57
69
  **Streaming** (SSE & WebSocket)
58
70
 
59
71
  - [SSE subscriptions](https://github.com/nessshon/tonapi/blob/main/examples/streaming_sse.py)
@@ -64,11 +76,6 @@ pip install pytonapi
64
76
  - [FastAPI webhook server](https://github.com/nessshon/tonapi/blob/main/examples/webhook_fastapi.py)
65
77
  - [aiohttp webhook server](https://github.com/nessshon/tonapi/blob/main/examples/webhook_aiohttp.py)
66
78
 
67
- **Transfers** (requires [tonutils](https://github.com/nessshon/tonutils))
68
-
69
- - [Transfer TON](https://github.com/nessshon/tonapi/blob/main/examples/transfer_ton.py)
70
- - [Gasless transfer](https://github.com/nessshon/tonapi/blob/main/examples/transfer_gasless.py)
71
-
72
79
  ## License
73
80
 
74
81
  This repository is distributed under the [MIT License](https://github.com/nessshon/tonapi/blob/main/LICENSE).
@@ -53,6 +53,20 @@ pytonapi = "pytonapi.cli:main"
53
53
  [project.urls]
54
54
  Homepage = "https://github.com/nessshon/tonapi/"
55
55
  Examples = "https://github.com/nessshon/tonapi/tree/main/examples/"
56
+ Documentation = "https://tonapi.ness.su/"
57
+
58
+ [project.optional-dependencies]
59
+ dev = [
60
+ "environs>=11.0.0",
61
+ "fastapi>=0.115.0",
62
+ "jinja2>=3.1",
63
+ "mypy>=1.19.0",
64
+ "pyyaml>=6.0",
65
+ "pytest>=8.0",
66
+ "pytest-asyncio>=0.24",
67
+ "ruff>=0.8.0",
68
+ "uvicorn>=0.34.0",
69
+ ]
56
70
 
57
71
  [tool.setuptools.packages.find]
58
72
  include = ["pytonapi", "pytonapi.*"]
@@ -128,10 +142,10 @@ ignore = [
128
142
  [tool.ruff.lint.per-file-ignores]
129
143
  "__init__.py" = ["F401"]
130
144
  "pytonapi/rest/models/*" = ["D101"]
131
- "tests/*" = ["D101", "D102", "T20"]
132
- "tests/rest/fixtures.py" = ["E501"]
133
145
  "codegen/*" = ["T20"]
134
146
  "examples/*" = ["D", "T20", "RUF006", "RUF059"]
147
+ "tests/*" = ["D101", "D102", "D103", "T20"]
148
+ "tests/rest/fixtures.py" = ["E501"]
135
149
 
136
150
  [tool.ruff.lint.isort]
137
151
  known-first-party = ["pytonapi"]
@@ -158,4 +172,7 @@ enable_error_code = [
158
172
  [[tool.mypy.overrides]]
159
173
  module = "tests.*"
160
174
  disallow_untyped_defs = false
161
- disallow_incomplete_defs = false
175
+ disallow_incomplete_defs = false
176
+
177
+ [tool.pytest.ini_options]
178
+ asyncio_mode = "auto"
@@ -3,6 +3,6 @@
3
3
  # This source code is licensed under the MIT License found in the
4
4
  # LICENSE file in the root directory of this source tree.
5
5
 
6
- __version__ = "2.1.0"
6
+ __version__ = "2.2.1"
7
7
  __author__ = "nessshon"
8
8
  __url__ = "https://github.com/nessshon/tonapi"
@@ -107,6 +107,18 @@ class BaseClient:
107
107
  await asyncio.sleep(0)
108
108
  self._session = None
109
109
 
110
+ @property
111
+ def session(self) -> aiohttp.ClientSession:
112
+ """Active ``aiohttp.ClientSession``.
113
+
114
+ :raises TONAPISessionNotCreatedError: If the session has not been
115
+ created yet — call ``create_session()`` or use the client as an
116
+ async context manager first.
117
+ """
118
+ if self._session is None or self._session.closed:
119
+ raise TONAPISessionNotCreatedError(self.__class__.__name__)
120
+ return self._session
121
+
110
122
  async def __aenter__(self: _Self) -> _Self:
111
123
  """Enter the async context manager."""
112
124
  await self.create_session()
@@ -0,0 +1,35 @@
1
+ from pytonapi.streaming.models import (
2
+ AccountState,
3
+ AccountStateNotification,
4
+ ActionsNotification,
5
+ ActionType,
6
+ ConnectionState,
7
+ EventType,
8
+ Finality,
9
+ JettonsNotification,
10
+ JettonWallet,
11
+ StreamNotification,
12
+ TraceInvalidatedNotification,
13
+ TraceNotification,
14
+ TransactionsNotification,
15
+ )
16
+ from pytonapi.streaming.sse import TonapiSSE
17
+ from pytonapi.streaming.ws import TonapiWebSocket
18
+
19
+ __all__ = [
20
+ "AccountState",
21
+ "AccountStateNotification",
22
+ "ActionType",
23
+ "ActionsNotification",
24
+ "ConnectionState",
25
+ "EventType",
26
+ "Finality",
27
+ "JettonWallet",
28
+ "JettonsNotification",
29
+ "StreamNotification",
30
+ "TonapiSSE",
31
+ "TonapiWebSocket",
32
+ "TraceInvalidatedNotification",
33
+ "TraceNotification",
34
+ "TransactionsNotification",
35
+ ]