jetrauserapi 1.0.0__py3-none-any.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,105 @@
1
+ import struct
2
+
3
+ def tl_bytes(data: bytes) -> bytes:
4
+ """Serialize bytes with TL length prefix"""
5
+ n = len(data)
6
+ if n <= 253:
7
+ buf = bytes([n]) + data
8
+ else:
9
+ buf = b'\xfe' + n.to_bytes(3, 'little') + data
10
+ return buf + b'\x00' * ((4 - len(buf) % 4) % 4)
11
+
12
+ def tl_string(s: str) -> bytes:
13
+ """Serialize a string as TL bytes"""
14
+ return tl_bytes(s.encode('utf-8'))
15
+
16
+ def tl_int(n: int) -> bytes:
17
+ """Serialize a 32-bit signed integer"""
18
+ return struct.pack("<i", n)
19
+
20
+ def tl_uint(n: int) -> bytes:
21
+ """Serialize a 32-bit unsigned integer"""
22
+ return struct.pack("<I", n)
23
+
24
+ def tl_long(n: int) -> bytes:
25
+ """Serialize a 64-bit signed integer"""
26
+ return struct.pack("<q", n)
27
+
28
+ def tl_ulong(n: int) -> bytes:
29
+ """Serialize a 64-bit unsigned integer"""
30
+ return struct.pack("<Q", n)
31
+
32
+ def tl_double(d: float) -> bytes:
33
+ """Serialize a 64-bit float"""
34
+ return struct.pack("<d", d)
35
+
36
+ def tl_bool(b: bool) -> bytes:
37
+ """Serialize a boolean (boolTrue or boolFalse)"""
38
+ return struct.pack("<I", 0x997275B5 if b else 0xBC799737)
39
+
40
+ def tl_vector(items: list) -> bytes:
41
+ """Serialize a vector of already-serialized items"""
42
+ result = struct.pack("<I", 0x1CB5C415) + struct.pack("<i", len(items))
43
+ for item in items:
44
+ result += item
45
+ return result
46
+
47
+ def tl_vector_int(items: list) -> bytes:
48
+ """Serialize a vector of 32-bit integers"""
49
+ return tl_vector([tl_int(x) for x in items])
50
+
51
+ def tl_vector_long(items: list) -> bytes:
52
+ """Serialize a vector of 64-bit integers"""
53
+ return tl_vector([tl_long(x) for x in items])
54
+
55
+ def tl_vector_string(items: list) -> bytes:
56
+ """Serialize a vector of strings"""
57
+ return tl_vector([tl_string(x) for x in items])
58
+
59
+ def tl_read_bytes(data: bytes, offset: int):
60
+ """Read TL bytes from data at offset. Returns (value, new_offset)"""
61
+ n = data[offset]
62
+ if n < 0xFE:
63
+ val = data[offset+1:offset+1+n]
64
+ new_offset = offset + 1 + n
65
+ else:
66
+ n = int.from_bytes(data[offset+1:offset+4], 'little')
67
+ val = data[offset+4:offset+4+n]
68
+ new_offset = offset + 4 + n
69
+ new_offset = (new_offset + 3) & ~3
70
+ return val, new_offset
71
+
72
+ def tl_read_string(data: bytes, offset: int):
73
+ """Read TL string from data at offset. Returns (string, new_offset)"""
74
+ val, new_offset = tl_read_bytes(data, offset)
75
+ return val.decode('utf-8', errors='ignore'), new_offset
76
+
77
+ def tl_read_int(data: bytes, offset: int):
78
+ """Read 32-bit signed integer"""
79
+ return struct.unpack("<i", data[offset:offset+4])[0], offset + 4
80
+
81
+ def tl_read_uint(data: bytes, offset: int):
82
+ """Read 32-bit unsigned integer"""
83
+ return struct.unpack("<I", data[offset:offset+4])[0], offset + 4
84
+
85
+ def tl_read_long(data: bytes, offset: int):
86
+ """Read 64-bit signed integer"""
87
+ return struct.unpack("<q", data[offset:offset+8])[0], offset + 8
88
+
89
+ def tl_read_ulong(data: bytes, offset: int):
90
+ """Read 64-bit unsigned integer"""
91
+ return struct.unpack("<Q", data[offset:offset+8])[0], offset + 8
92
+
93
+ def tl_read_double(data: bytes, offset: int):
94
+ """Read 64-bit float"""
95
+ return struct.unpack("<d", data[offset:offset+8])[0], offset + 8
96
+
97
+ def tl_read_vector_header(data: bytes, offset: int):
98
+ """Read vector constructor and count. Returns (count, new_offset) or (None, offset) if not a vector"""
99
+ if offset + 8 > len(data):
100
+ return None, offset
101
+ ctor = struct.unpack("<I", data[offset:offset+4])[0]
102
+ if ctor != 0x1CB5C415:
103
+ return None, offset
104
+ count = struct.unpack("<i", data[offset+4:offset+8])[0]
105
+ return count, offset + 8
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: jetrauserapi
3
+ Version: 1.0.0
4
+ Summary: A Python library for interacting with Jetra Messenger (User Account)
5
+ Home-page: https://github.com/YOUR_USERNAME/JetraUserAPI
6
+ Author: Ali VEX
7
+ Author-email: Ali VEX <your-email@example.com>
8
+ License: MIT
9
+ Project-URL: Homepage, https://github.com/YOUR_USERNAME/JetraUserAPI
10
+ Project-URL: Repository, https://github.com/YOUR_USERNAME/JetraUserAPI
11
+ Project-URL: Issues, https://github.com/YOUR_USERNAME/JetraUserAPI/issues
12
+ Keywords: jetra,messenger,api,client,telethon
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: License :: OSI Approved :: MIT License
18
+ Classifier: Operating System :: OS Independent
19
+ Classifier: Development Status :: 4 - Beta
20
+ Classifier: Intended Audience :: Developers
21
+ Classifier: Topic :: Communications :: Chat
22
+ Requires-Python: >=3.10
23
+ Description-Content-Type: text/markdown
24
+ License-File: LICENSE
25
+ Requires-Dist: websockets>=10.0
26
+ Requires-Dist: pycryptodome>=3.15.0
27
+ Dynamic: author
28
+ Dynamic: home-page
29
+ Dynamic: license-file
30
+ Dynamic: requires-python
31
+
32
+ # JetraUserAPI
33
+
34
+ [![Python](https://img.shields.io/badge/Python-3.10%2B-blue)](https://www.python.org/)
35
+ [![License](https://img.shields.io/badge/License-MIT-green)](LICENSE)
36
+
37
+ A Python library for interacting with **Jetra Messenger** using user accounts.
38
+
39
+ Inspired by [Telethon](https://github.com/LonamiWebs/Telethon), JetraUserAPI provides a simple and clean API for automating Jetra Messenger.
40
+
41
+ ## Features
42
+
43
+ - Login with phone number and OTP
44
+ - Send and receive text messages in private chats (PV)
45
+ - Send and receive text messages in groups
46
+ - Get list of dialogs (users and groups)
47
+ - Local SQLite database for message history
48
+ - Auto-reconnect on connection loss
49
+ - Event handlers (`on_message`, `on_ready`)
50
+ - Auto-detection of peer type (user vs group)
51
+ - Clean async/await API
52
+
53
+ ## Limitations
54
+
55
+ The Jetra server blocks several operations for web clients:
56
+
57
+ - Sending media (photos, videos, files)
58
+ - Deleting messages
59
+ - Group management (ban, admin)
60
+ - Message history from server
61
+
62
+ ## Installation
63
+
64
+ ```bash
65
+ git clone https://github.com/YOUR_USERNAME/JetraUserAPI.git
66
+ cd JetraUserAPI
67
+ pip install -e .
@@ -0,0 +1,13 @@
1
+ jetrauserapi/__init__.py,sha256=H8zxvuPCv_Lr_WuynAxQGQl7wRcg3Ijnkcv-DKk-Vv4,198
2
+ jetrauserapi/client.py,sha256=cKQU7OI-JfH1w-uF4fTnrwNdHgcWOScqhXy1yVa2WsQ,18584
3
+ jetrauserapi/config.py,sha256=MoPWsU1BhecXdqNFFbpKYminANPB5C6NQFKIosT72Eo,383
4
+ jetrauserapi/database.py,sha256=SMPz_znpZQWmTmIShpdXo25-Tw6sirOEk_8l_SAR8WA,3523
5
+ jetrauserapi/high_level.py,sha256=NvtQzp7pSSHTXz8vgv4o7uYBDvss3O_6Z2z9CoQOPSU,17267
6
+ jetrauserapi/message.py,sha256=0ccMTO3PQty2nfvQiUeOpcNkS9jgV15JNXG72BiE2oI,1661
7
+ jetrauserapi/session.py,sha256=Ax87nVNiSTwMC9KSA_q7xBW0f8llyU67HWVUX3Y1nXQ,2796
8
+ jetrauserapi/tl_builder.py,sha256=UT182fMWC3TiksKLwQzKgNLMsMiIji9jCNcnXlLvnpI,3581
9
+ jetrauserapi-1.0.0.dist-info/licenses/LICENSE,sha256=qrhkXM8xfFmxdZc3c0xIyeo_4VmE5vYMiwJIwfuyT6o,1064
10
+ jetrauserapi-1.0.0.dist-info/METADATA,sha256=0mBiVxymmhbujvdwkVJvxBMv5n7nnuAjDpif3fCo0RY,2289
11
+ jetrauserapi-1.0.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
12
+ jetrauserapi-1.0.0.dist-info/top_level.txt,sha256=HzkTVLamVEDF6fkRBXOSwfHl1JwngokAItVnXvJAOEI,13
13
+ jetrauserapi-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.2.1)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ali VEX
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.
@@ -0,0 +1 @@
1
+ jetrauserapi