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.
- {pytonapi-2.1.0/pytonapi.egg-info → pytonapi-2.2.1}/PKG-INFO +24 -6
- {pytonapi-2.1.0 → pytonapi-2.2.1}/README.md +12 -5
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pyproject.toml +20 -3
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/__meta__.py +1 -1
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/client.py +12 -0
- pytonapi-2.2.1/pytonapi/streaming/__init__.py +35 -0
- pytonapi-2.2.1/pytonapi/streaming/base.py +492 -0
- pytonapi-2.2.1/pytonapi/streaming/models.py +196 -0
- pytonapi-2.2.1/pytonapi/streaming/sse.py +159 -0
- pytonapi-2.2.1/pytonapi/streaming/ws.py +282 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/webhook/dispatcher.py +42 -32
- {pytonapi-2.1.0 → pytonapi-2.2.1/pytonapi.egg-info}/PKG-INFO +24 -6
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi.egg-info/SOURCES.txt +2 -1
- pytonapi-2.2.1/pytonapi.egg-info/requires.txt +13 -0
- pytonapi-2.2.1/tests/test_client.py +32 -0
- pytonapi-2.1.0/pytonapi/streaming/__init__.py +0 -19
- pytonapi-2.1.0/pytonapi/streaming/client.py +0 -95
- pytonapi-2.1.0/pytonapi/streaming/models.py +0 -33
- pytonapi-2.1.0/pytonapi/streaming/sse.py +0 -254
- pytonapi-2.1.0/pytonapi/streaming/ws.py +0 -229
- pytonapi-2.1.0/pytonapi.egg-info/requires.txt +0 -2
- {pytonapi-2.1.0 → pytonapi-2.2.1}/LICENSE +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/__init__.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/cli.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/exceptions.py +1 -1
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/py.typed +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/__init__.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/client.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/limiter.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/mixin.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/__init__.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/_enums.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/accounts.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/blockchain.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/connect.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/dns.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/emulation.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/events.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/extra_currency.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/gasless.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/jettons.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/lite_server.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/multisig.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/nft.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/purchases.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/rates.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/staking.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/storage.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/traces.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/utilities.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/models/wallet.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/__init__.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/_base.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/accounts.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/blockchain.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/connect.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/dns.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/emulation.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/events.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/extra_currency.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/gasless.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/jettons.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/lite_server.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/multisig.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/nft.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/purchases.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/rates.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/staking.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/storage.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/traces.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/utilities.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/resources/wallet.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/rest/rotator.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/types.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/utils.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/webhook/__init__.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/webhook/client.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi/webhook/models.py +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi.egg-info/dependency_links.txt +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi.egg-info/entry_points.txt +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/pytonapi.egg-info/top_level.txt +0 -0
- {pytonapi-2.1.0 → pytonapi-2.2.1}/setup.cfg +0 -0
- {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
|
|
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
|

|
|
41
52
|

|
|
42
53
|

|
|
54
|
+
[](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
|

|
|
12
12
|

|
|
13
13
|

|
|
14
|
+
[](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"
|
|
@@ -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
|
+
]
|