tdjson 1.8.56.post3__cp39-cp39-win_amd64.whl
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.
Potentially problematic release.
This version of tdjson might be problematic. Click here for more details.
- tdjson/__init__.py +35 -0
- tdjson/tdjson.cpp +17 -0
- tdjson/tdjson_ext.cp39-win_amd64.pyd +0 -0
- tdjson-1.8.56.post3.dist-info/DELVEWHEEL +2 -0
- tdjson-1.8.56.post3.dist-info/METADATA +62 -0
- tdjson-1.8.56.post3.dist-info/RECORD +14 -0
- tdjson-1.8.56.post3.dist-info/WHEEL +5 -0
- tdjson-1.8.56.post3.dist-info/licenses/LICENSE +21 -0
- tdjson.libs/.load-order-tdjson-1.8.56.post3 +5 -0
- tdjson.libs/libcrypto-1_1-x64-e49918c764ec483eebd41c009e8eb34f.dll +0 -0
- tdjson.libs/libssl-1_1-x64-3bffe2c986c235bbe3dcf336937fc666.dll +0 -0
- tdjson.libs/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll +0 -0
- tdjson.libs/tdjson-dd6612b1cc6e05f52c1cb67fc37280f8.dll +0 -0
- tdjson.libs/zlib1-cb7ab3788d10940df874acd97b1821bb.dll +0 -0
tdjson/__init__.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""""" # start delvewheel patch
|
|
2
|
+
def _delvewheel_patch_1_11_2():
|
|
3
|
+
import ctypes
|
|
4
|
+
import os
|
|
5
|
+
import platform
|
|
6
|
+
import sys
|
|
7
|
+
libs_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir, 'tdjson.libs'))
|
|
8
|
+
is_conda_cpython = platform.python_implementation() == 'CPython' and (hasattr(ctypes.pythonapi, 'Anaconda_GetVersion') or 'packaged by conda-forge' in sys.version)
|
|
9
|
+
if sys.version_info[:2] >= (3, 8) and not is_conda_cpython or sys.version_info[:2] >= (3, 10):
|
|
10
|
+
if os.path.isdir(libs_dir):
|
|
11
|
+
os.add_dll_directory(libs_dir)
|
|
12
|
+
else:
|
|
13
|
+
load_order_filepath = os.path.join(libs_dir, '.load-order-tdjson-1.8.56.post3')
|
|
14
|
+
if os.path.isfile(load_order_filepath):
|
|
15
|
+
import ctypes.wintypes
|
|
16
|
+
with open(os.path.join(libs_dir, '.load-order-tdjson-1.8.56.post3')) as file:
|
|
17
|
+
load_order = file.read().split()
|
|
18
|
+
kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
|
|
19
|
+
kernel32.LoadLibraryExW.restype = ctypes.wintypes.HMODULE
|
|
20
|
+
kernel32.LoadLibraryExW.argtypes = ctypes.wintypes.LPCWSTR, ctypes.wintypes.HANDLE, ctypes.wintypes.DWORD
|
|
21
|
+
for lib in load_order:
|
|
22
|
+
lib_path = os.path.join(os.path.join(libs_dir, lib))
|
|
23
|
+
if os.path.isfile(lib_path) and not kernel32.LoadLibraryExW(lib_path, None, 8):
|
|
24
|
+
raise OSError('Error loading {}; {}'.format(lib, ctypes.FormatError(ctypes.get_last_error())))
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
_delvewheel_patch_1_11_2()
|
|
28
|
+
del _delvewheel_patch_1_11_2
|
|
29
|
+
# end delvewheel patch
|
|
30
|
+
|
|
31
|
+
from .tdjson_ext import td_create_client_id, td_send, td_receive, td_execute
|
|
32
|
+
|
|
33
|
+
__version__ = "1.8.56.post3"
|
|
34
|
+
__copyright__ = "Copyright (c) 2025 AYMENJD"
|
|
35
|
+
__license__ = "MIT License"
|
tdjson/tdjson.cpp
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#include <nanobind/nanobind.h>
|
|
2
|
+
#include <td/telegram/td_json_client.h>
|
|
3
|
+
|
|
4
|
+
namespace nb = nanobind;
|
|
5
|
+
|
|
6
|
+
NB_MODULE(tdjson_ext, m) {
|
|
7
|
+
m.def("td_create_client_id", &td_create_client_id, nb::call_guard<nb::gil_scoped_release>(),
|
|
8
|
+
"Returns an opaque identifier of a new TDLib instance")
|
|
9
|
+
.def("td_send", &td_send, nb::call_guard<nb::gil_scoped_release>(), nb::arg("client_id"), nb::arg("request"),
|
|
10
|
+
"Sends request to the TDLib client. May be called from any thread")
|
|
11
|
+
.def("td_receive", &td_receive, nb::call_guard<nb::gil_scoped_release>(), nb::arg("timeout"),
|
|
12
|
+
"Receives incoming updates and request responses. Must not be called simultaneously from two different "
|
|
13
|
+
"threads")
|
|
14
|
+
.def("td_execute", &td_execute, nb::call_guard<nb::gil_scoped_release>(), nb::arg("request"),
|
|
15
|
+
"Synchronously executes a TDLib request");
|
|
16
|
+
// TODO: td_set_log_message_callback?
|
|
17
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
Version: 1.11.2
|
|
2
|
+
Arguments: ['C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-qrxhze5s\\cp39-win_amd64\\build\\venv\\Scripts\\delvewheel', 'repair', '-w', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-qrxhze5s\\cp39-win_amd64\\repaired_wheel', 'C:\\Users\\runneradmin\\AppData\\Local\\Temp\\cibw-run-qrxhze5s\\cp39-win_amd64\\built_wheel\\tdjson-1.8.56.post3-cp39-cp39-win_amd64.whl']
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
|
+
Name: tdjson
|
|
3
|
+
Version: 1.8.56.post3
|
|
4
|
+
Summary: High-performance Python binding for TDLib JSON interface. Works on Linux x86_64, includes pre-built TDLib, and outperforms python ctypes
|
|
5
|
+
Keywords: tdlib,telegram,python-binding,high-performance,linux
|
|
6
|
+
Author-Email: AYMEN Mohammed <let.me.code.safe@gmail.com>
|
|
7
|
+
License: MIT
|
|
8
|
+
Project-URL: Source, https://github.com/AYMENJD/tdjson
|
|
9
|
+
Project-URL: Tracker, https://github.com/AYMENJD/tdjson/issues
|
|
10
|
+
Requires-Python: >=3.9
|
|
11
|
+
Description-Content-Type: text/markdown
|
|
12
|
+
|
|
13
|
+
# tdjson [](https://pypi.org/project/tdjson) [](https://github.com/tdlib/td) [](https://pepy.tech/project/tdjson)
|
|
14
|
+
|
|
15
|
+
`tdjson` is a high-performance Python binding for [TDLib](https://github.com/tdlib/td)'s JSON interface. Outperforms `ctypes`, and **includes** `TDLib` for easy setup and use. Mainly created for [Pytdbot](https://github.com/pytdbot/client)
|
|
16
|
+
|
|
17
|
+
## Compatibility
|
|
18
|
+
|
|
19
|
+
`tdjson` is compatible with most Linux `x86_64` and `aarch64` (arm64) distributions that use `glibc 2.17+`. This includes most modern Linux distributions:
|
|
20
|
+
|
|
21
|
+
- Debian 8+
|
|
22
|
+
- Ubuntu 13.10+
|
|
23
|
+
- Fedora 19+
|
|
24
|
+
- RHEL 7+
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
You can install `tdjson` directly from PyPI:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pip install tdjson
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Usage
|
|
35
|
+
|
|
36
|
+
Here’s a quick example to get you started:
|
|
37
|
+
|
|
38
|
+
```python
|
|
39
|
+
import json
|
|
40
|
+
import tdjson
|
|
41
|
+
|
|
42
|
+
# Create a new TDLib client
|
|
43
|
+
client_id = tdjson.td_create_client_id()
|
|
44
|
+
|
|
45
|
+
# Send a request to TDLib
|
|
46
|
+
request = {"@type": "getOption", "name": "version"}
|
|
47
|
+
tdjson.td_send(client_id, json.dumps(request))
|
|
48
|
+
|
|
49
|
+
# Receive updates or responses
|
|
50
|
+
response = tdjson.td_receive(10.0)
|
|
51
|
+
print(response)
|
|
52
|
+
|
|
53
|
+
# Synchronously execute a TDLib request
|
|
54
|
+
result = tdjson.td_execute(json.dumps({"@type": "getTextEntities", "text": "@telegram /test_command https://telegram.org telegram.me", "@extra": ["5", 7.0, "a"]}))
|
|
55
|
+
print(result)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
For more detailed examples, check out the [examples](https://github.com/AYMENJD/tdjson/blob/main/examples) folder.
|
|
59
|
+
|
|
60
|
+
## License
|
|
61
|
+
|
|
62
|
+
MIT [LICENSE](https://github.com/AYMENJD/tdjson/blob/main/LICENSE)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
tdjson/tdjson.cpp,sha256=K0Anr2CnYUuFur1cxEYFb0a2gYRGajPdIS3uuxA0hrE,930
|
|
2
|
+
tdjson/tdjson_ext.cp39-win_amd64.pyd,sha256=zGT5mG3FS1aSstdvgpLYIwmwmNd5YGZECUzzXU9cXEg,70144
|
|
3
|
+
tdjson/__init__.py,sha256=omo6Z2Ji4Tdq7i6omcK8qDKwUU-EbW3LhPqVYNHsP8Y,1730
|
|
4
|
+
tdjson-1.8.56.post3.dist-info/DELVEWHEEL,sha256=vK2o8s-94ACzw_cKc8xgdBhPngR2M9-ukDLR88Utg54,401
|
|
5
|
+
tdjson-1.8.56.post3.dist-info/METADATA,sha256=cCHQKYK9JEwtrcMDfcpCN3pToe5E_g9xPjhxEJpQhNk,2282
|
|
6
|
+
tdjson-1.8.56.post3.dist-info/RECORD,,
|
|
7
|
+
tdjson-1.8.56.post3.dist-info/WHEEL,sha256=9tsL4JT94eZPTkcS3bNng2riasYJMxXndrO9CxUfJHs,104
|
|
8
|
+
tdjson-1.8.56.post3.dist-info/licenses/LICENSE,sha256=5UtIwVyAt1vfjtGnPfb13fQ3MydM56MWonFOFO_TXtQ,1083
|
|
9
|
+
tdjson.libs/.load-order-tdjson-1.8.56.post3,sha256=pNiU4IrwXjkw5Xas_grCBgfgbl6H-6fYGWTS2Wo0aiE,240
|
|
10
|
+
tdjson.libs/libcrypto-1_1-x64-e49918c764ec483eebd41c009e8eb34f.dll,sha256=5JkYx2TsSD7r1BwAno6zTxYhAx1DbgZ_2zqeuq0SDs4,3515904
|
|
11
|
+
tdjson.libs/libssl-1_1-x64-3bffe2c986c235bbe3dcf336937fc666.dll,sha256=eUd6uZANYoQN6_N-020QtTVL9uZjzICVoueeFSzSFVs,694272
|
|
12
|
+
tdjson.libs/msvcp140-a4c2229bdc2a2a630acdc095b4d86008.dll,sha256=pMIim9wqKmMKzcCVtNhgCOXD47x3cxdDVPPaT1vrnN4,575056
|
|
13
|
+
tdjson.libs/tdjson-dd6612b1cc6e05f52c1cb67fc37280f8.dll,sha256=2ofoloOTxHqO6OIkdEBZXntyvsBnGHLjaYgTsaDNgzo,24933376
|
|
14
|
+
tdjson.libs/zlib1-cb7ab3788d10940df874acd97b1821bb.dll,sha256=y3qzeI0QlA34dKzZexghu7XuSpHz7sEZgrtb96PJZEM,120814
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 AYMEN
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|