python-telegram 2.0.0__py3-none-macosx_11_0_arm64.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.
@@ -0,0 +1,156 @@
1
+ Metadata-Version: 2.5
2
+ Name: python-telegram
3
+ Version: 2.0.0
4
+ Summary: Python library to help you build your own Telegram clients
5
+ Project-URL: Source, https://github.com/alexander-akhmetov/python-telegram
6
+ Project-URL: Documentation, https://python-telegram.readthedocs.io/latest/
7
+ Project-URL: Tutorial, https://python-telegram.readthedocs.io/latest/tutorial.html
8
+ Project-URL: Changelog, https://python-telegram.readthedocs.io/latest/changelog.html
9
+ Author-email: Alexander Akhmetov <me@alx.cx>
10
+ License: MIT
11
+ License-File: LICENSE
12
+ Keywords: api,client,td,tdjson,tdlib,telegram
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Operating System :: MacOS :: MacOS X
16
+ Classifier: Operating System :: POSIX :: Linux
17
+ Classifier: Programming Language :: Python :: 3 :: Only
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Programming Language :: Python :: 3.14
23
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
24
+ Requires-Python: >=3.10
25
+ Requires-Dist: telegram-text==0.2.0
26
+ Description-Content-Type: text/markdown
27
+
28
+ # python-telegram
29
+
30
+ [![Build Status](https://github.com/alexander-akhmetov/python-telegram/workflows/python-telegram%20tests/badge.svg)](https://github.com/alexander-akhmetov/python-telegram/actions)
31
+ [![PyPI](https://img.shields.io/pypi/v/python-telegram.svg)](https://pypi.python.org/pypi/python-telegram)
32
+ [![Read the Docs](https://img.shields.io/readthedocs/python-telegram/latest.svg)](https://python-telegram.readthedocs.io/latest/)
33
+
34
+ Python API for the [tdlib](https://github.com/tdlib/td) library.
35
+ It helps you build your own Telegram clients.
36
+
37
+ `tdlib` connects to Telegram over MTProto, the same protocol the official apps use.
38
+ This library signs in as a full Telegram account with a phone number, and it can do what a regular client can do.
39
+
40
+ It is not a wrapper around the HTTP Bot API.
41
+ If you only need a bot, [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) is a better fit.
42
+ You can still sign in as a bot here by passing `bot_token` instead of `phone`.
43
+
44
+ - [Changelog](https://python-telegram.readthedocs.io/latest/changelog.html)
45
+ - [Documentation](https://python-telegram.readthedocs.io/latest/)
46
+ - [Tutorial](https://python-telegram.readthedocs.io/latest/tutorial.html)
47
+
48
+ ## Installation
49
+
50
+ This library requires Python 3.10+. Windows is not supported.
51
+
52
+ ```shell
53
+ pip install python-telegram
54
+ ```
55
+
56
+ See [documentation](https://python-telegram.readthedocs.io/latest/#installation) for more details.
57
+
58
+ ### tdlib
59
+
60
+ Four wheels bundle a `tdlib` binary. Each one works on Python 3.10 through 3.14:
61
+
62
+ | Platform | Wheel | Needs at least |
63
+ | --- | --- | --- |
64
+ | Linux x86_64 | `manylinux_2_28_x86_64` | glibc 2.28 |
65
+ | Linux aarch64 | `manylinux_2_28_aarch64` | glibc 2.28 |
66
+ | macOS arm64 | `macosx_11_0_arm64` | macOS 11 |
67
+ | macOS x86_64 | `macosx_10_15_x86_64` | macOS 10.15 |
68
+
69
+ Those binaries link OpenSSL and zlib statically, so they need nothing from the system.
70
+
71
+ Anywhere else, pip installs the source distribution, which carries no binary. On musl, on
72
+ 32-bit ARM, or with an older glibc, [compile](https://tdlib.github.io/td/build.html) `tdlib`
73
+ yourself.
74
+
75
+ `python-telegram` looks for the library in this order, and logs which one it used:
76
+
77
+ 1. the `library_path` argument
78
+ 2. the `PYTHON_TELEGRAM_TDLIB_PATH` environment variable
79
+ 3. a system-wide `tdjson`
80
+ 4. the bundled binary
81
+
82
+ A system-wide `tdlib` therefore wins over the bundled one. To point at a specific build,
83
+ pass its path. The file is called `libtdjson.so` on Linux and `libtdjson.dylib` on macOS:
84
+
85
+ ```python
86
+ tg = Telegram(
87
+ # ...
88
+ library_path="/usr/local/lib/libtdjson.so",
89
+ )
90
+ ```
91
+
92
+ If nothing can be found, `TDJson()` raises `TDLibNotFoundError`, an `OSError` subclass whose
93
+ message names the platform, the paths tried and the overrides.
94
+
95
+ ### Docker
96
+
97
+ This library has a [docker image](https://hub.docker.com/r/akhmetov/python-telegram/):
98
+
99
+ ```sh
100
+ docker run -i -t --rm \
101
+ -v /tmp/docker-python-telegram/:/tmp/ \
102
+ akhmetov/python-telegram \
103
+ python3 /app/examples/send_message.py $API_ID $API_HASH $PHONE $CHAT_ID $TEXT
104
+ ```
105
+
106
+ ## How to use the library
107
+
108
+ First, [register a new Telegram application](https://my.telegram.org/apps/) to get your `api_id` and `api_hash`.
109
+ Check out the [tutorial](https://python-telegram.readthedocs.io/latest/tutorial.html) for more details.
110
+
111
+ Basic example:
112
+
113
+ ```python
114
+ from telegram.client import Telegram
115
+ from telegram.text import Spoiler
116
+
117
+ tg = Telegram(
118
+ api_id=123456,
119
+ api_hash="api_hash",
120
+ phone="+31611111111", # you can pass 'bot_token' instead
121
+ database_encryption_key="changekey123",
122
+ files_directory="/tmp/.tdlib_files/",
123
+ )
124
+ tg.login()
125
+
126
+ # The chat must be in the tdlib database before you can send a message to it.
127
+ # `get_chats` loads up to `limit` chats from the main chat list.
128
+ result = tg.get_chats(limit=100)
129
+ result.wait()
130
+
131
+ chat_id = 123456789
132
+ result = tg.send_message(chat_id, Spoiler("Hello world!"))
133
+
134
+ # `tdlib` is asynchronous, so `python-telegram` always returns an `AsyncResult` object.
135
+ # You can receive a result with the `wait` method of this object.
136
+ result.wait()
137
+ print(result.update)
138
+
139
+ tg.stop() # You must call `stop` at the end of the script.
140
+ ```
141
+
142
+ You can also use `call_method` to call any [tdlib method](https://core.telegram.org/tdlib/docs/classtd_1_1td__api_1_1_function.html):
143
+
144
+ ```python
145
+ tg.call_method("getUser", params={"user_id": user_id})
146
+ ```
147
+
148
+ More examples can be found in the [/examples/ directory](/examples/).
149
+
150
+ ---
151
+
152
+ More information is available in the [documentation](https://python-telegram.readthedocs.io/latest/).
153
+
154
+ ## Development
155
+
156
+ See [CONTRIBUTING.md](/CONTRIBUTING.md).
@@ -0,0 +1,12 @@
1
+ telegram/__init__.py,sha256=g1IQmdOuP4SMpDzs9slBUBDdsKwlUQFrg2pAebkx5Vk,45
2
+ telegram/client.py,sha256=BKN17mnksqq7YVAjhMxc-CeAFnzoOm2D7m-axAF-xgQ,36986
3
+ telegram/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ telegram/tdjson.py,sha256=9-AfgnzJZZgtgxVeMEqBFy4wJRHr9zK2-4L5k3Sr_co,6822
5
+ telegram/text.py,sha256=uUBOhxKj5hfcaDgf5IQDT1C78KnnvYsRk3GRdf-VXn0,802
6
+ telegram/utils.py,sha256=jvW4OvYCsRBxhjIZjSYFwReJ-b9vcSeMtBJWp9puafs,2061
7
+ telegram/worker.py,sha256=t6qzRFhURcj8N67U2Bzc1H6ma7y52p1FymZDrtqBSJo,1250
8
+ telegram/lib/libtdjson.dylib,sha256=k6bQeKnhq7IhVY9KOaN7wzixZ1ZyG2kfPpXDyi2nRXI,27786384
9
+ python_telegram-2.0.0.dist-info/METADATA,sha256=YL4ZmbMHaB2d7dhsUcgqdhy7qA6fqvPgv7d614E2P5g,5829
10
+ python_telegram-2.0.0.dist-info/WHEEL,sha256=X_XT35qwFyuTF8LewfTGgVi6_4WoC3HnGv5CQcZCRtY,102
11
+ python_telegram-2.0.0.dist-info/licenses/LICENSE,sha256=ZiH3WbD6o37C65kBPDH1TScRsXVK7ACPqmB_OXuHB08,1075
12
+ python_telegram-2.0.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.0
3
+ Root-Is-Purelib: false
4
+ Tag: py3-none-macosx_11_0_arm64
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2018 Alexander Akhmetov
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.
telegram/__init__.py ADDED
@@ -0,0 +1,3 @@
1
+ __version__ = "2.0.0"
2
+
3
+ VERSION = __version__