Commit Graph

872 Commits

Author SHA1 Message Date
Lonami Exo
be2bdc0e13 Implements and closes #12 (custom session objects) 2016-11-30 15:36:59 +01:00
Fadi Hadzh
d087941bd0 Many code-style improvements 2016-11-30 00:29:42 +03:00
Fadi Hadzh
ef264ae83f Add pre-commit hooks configuration 2016-11-30 00:29:05 +03:00
Lonami Exo
6c93d08b8d Added two-step verification (fixes #4) and more info for errors 2016-11-26 12:04:02 +01:00
Lonami Exo
be94bff576 Patched code generator and updated README.rst removing markdown leftovers 2016-11-23 21:03:58 +01:00
Lonami Exo
4d96de8ab5 Changed README.md to README.rst 2016-11-13 15:39:47 +01:00
Lonami Exo
d290a569c5 Added webp mime type (useful when downloading stickers) 2016-11-13 14:51:50 +01:00
Lonami
308adc4192 Fixed invalid parameters when downloading documents 2016-10-09 13:47:38 +02:00
Lonami
a42effc2b5 Externalized TelegramClient utilities and added more 2016-10-09 12:57:38 +02:00
Lonami
b52cb12b2a Merge pull request #8 from MuallimCh/patch-1
Update tcp_transport.py to increment send_counter in case it fails
2016-10-09 10:18:39 +02:00
LiemCH
38bf460930 Update tcp_transport.py
Counter before send, in case of fail send, will not result error 500 random_id_duplicate
2016-10-09 10:10:41 +07:00
Lonami
6a32c6cd7a Moved requests .constructor_id to be a class-level variable 2016-10-04 18:55:02 +02:00
Lonami
f2728f47c3 Updated scheme to layer 57 and fixes to README links 2016-10-03 19:57:21 +02:00
Lonami
2a666f7ee0 Added ability to download profile photos, changes to get_dialogs()
The `get_dialogs()` method now returns dialogs and "entities",
which can be an User, a Chat or even a Channel.
In order to use them you may want to make use of .get_input_peer()
and .get_display_name() methods
2016-10-03 19:44:01 +02:00
Lonami
7399bfacd1 Implemented receive timeout (#6) and fixed error string 2016-10-03 09:54:17 +02:00
Lonami
1ecd51c7d1 Implemented #1 (Sending messages read acknowledge) 2016-10-02 13:57:03 +02:00
Lonami
30f15e67ac Avoid listening for updates if no update handlers are added
This only caused issues if it was the first time we logged in.
All the cases are now covered
2016-10-02 13:42:17 +02:00
Lonami
e035939aa2 Attempt at fixing #5 (RPCError) and updated README
Now RPC results can be received from the updates thread, as long
as they are errors. This, however, should not happen!
A recursive lock is now used (and released on every method, rather
than only on the `.receive()` one)
2016-10-02 13:30:14 +02:00
Lonami
77aa37d2ad Added an .empty() function to the objects, fixes to msgs_ack
The .empty() function returns an "empty" instance of the object
(attributes set to None). This is used rather than using reflection.

The msgs_ack handling broke stuff (InvokeWithLayer when there were
updates), so this is now handled; yet there may be a better fix
2016-09-26 17:18:25 +02:00
Lonami
ded655911e Added ability to both read and write vectors*
This change affects the BinaryReader and BinaryWriter
Note that it only allows to write vectors of **TLObjects**,
not any other type
2016-09-26 16:10:07 +02:00
Lonami
36b8a9026f Fixed revert by hand (I hope) 2016-09-26 13:13:11 +02:00
Lonami
4d5e11f4af Revert "Fixed logging out, added a proper function to list sessions"
This reverts commit 87969745f5.
The main purpose is to get rid of the JSON encoding (useless)
2016-09-26 13:06:36 +02:00
Lonami
b68772aab5 Fixed JSON encoding and decoding for lists, added empty() method
The new empty() method retrieves an empty instance of the
given object, with all the attributes set to None
2016-09-25 10:50:48 +02:00
Lonami
fddb3e9aac Added ability to encode/decode TLObjects, updated README 2016-09-24 21:17:41 +02:00
Lonami
87969745f5 Fixed logging out, added a proper function to list sessions
By fixing logging out, other request probably got fixed as well,
since now we can also read MessagesAcknowledge requests
2016-09-23 12:50:01 +02:00
Lonami
d8757af5c5 Updated README, minor changes and pip ready
The module is now ready to be installed via pip
README.md has been updated to reflect these changes
Minor changes to the interactive client example
Versioning is now done by editting TelegramClient's
__version__, rather than looking for the string
2016-09-18 12:04:17 +02:00
Lonami
6642f73a3d Detect current MTProtoLayer automatically 2016-09-17 21:09:20 +02:00
Lonami
51a531225f Totally refactored source files location
Now it *should* be easier to turn Telethon
into a pip package
2016-09-17 20:45:12 +02:00
Lonami
27ec7292d8 Improvements to file uploading and progress added
Now you can let the file part size be determined
by the total file size, rather than manually
specifying one. Also, a callback function parameter
has been added (which allows to print the progress)
2016-09-17 17:04:30 +02:00
Lonami
15994d0b78 Added ability to upload large files 2016-09-16 16:37:45 +02:00
Lonami
922f17956b Pythonized some parts 2016-09-16 14:04:46 +02:00
Lonami
6ee93122f2 Added ability to both log-out and sign-up 2016-09-16 13:35:14 +02:00
Lonami
9420e15283 Gave more power to the TelegramClients and bug fixes
Fixed uploads for large files on TcpClient
Added more RPCError's for handling invalid phone code
Added more media handlers: now you're also able to
  both send and download documents!
The InteractiveTelegramClient now supports working
  with media aswell
2016-09-12 19:32:16 +02:00
Lonami
13f7e6170f Added ability to download message media*
* Although this was already supported, now the
`InteractiveTelegramClient` has a command for it
2016-09-12 15:39:23 +02:00
Lonami
0fe0cdf682 Removed references to TLSharp since they're "ads"
See their #197 issue.
2016-09-12 14:16:17 +02:00
Lonami
a7c7fdd2e4 Refactored interactive example
The interactive example now lives in a separate
class, independant from `main.py` (which no longer
exists) so it's more intuitive.
2016-09-12 14:07:45 +02:00
Lonami
e664975170 Updated README.md
Now it specifies how to use `TelegramClient.invoke`
2016-09-11 17:22:01 +02:00
Lonami
1293d3be1c Added ability to download media
Now you can also download any message media,
exactly the same way you can upload any media
2016-09-11 16:24:03 +02:00
Lonami
7e78b1b6dc Added ability to upload and send media, and more fixes
Uploading and sending media are different things.
Once you have uploaded a media file, you can send
it to many users without uploading it again, since
you have a handle to the uploaded file.

Other fixes include not showing additional data
on error messages and not generating correct
code for sending bytes
2016-09-11 13:10:27 +02:00
Lonami
cdb1674a27 Minor improvement to updates handling
Now the updates thread won't start unless you add,
at least, one updates handler. Also, if the TcpClient
was receiving (i.e., from an update), it will let the
update to be received first instead of crashing
2016-09-11 11:50:38 +02:00
Lonami
c11795f294 Added native support for Python's datetime object
Now you can make up your Telegram Requests by using
the built-in `datetime` instead of manually parsing it
2016-09-11 10:35:02 +02:00
Lonami
5b4be5b85e Fixed bugs when handling updates
GZipPacked updates are now handled correctly.
Also, fixed another bug which did not allow
resending a request when BadServerSalt occured.
2016-09-10 20:06:37 +02:00
Lonami
0068c0fd8b Updated README.md 2016-09-10 14:10:47 +02:00
Lonami
72bc9df683 Made MtProtoSender multi-thread safe
This will allow you to, for example, send requests
when you get an update (if someone tells you something,
you can automatically reply something else). Beware,
this may lead to an infinite loop so add conditions!
2016-09-10 11:01:03 +02:00
Lonami
e47344c0f0 Added a thread lock to the TcpClient
This gives multi-threading safety without giving up on speed
(now there's no need for additional sleeps)
2016-09-10 10:17:15 +02:00
Lonami
fd14a5a49a Added an updates thread and construtor_id to TLObjects
A new thread is now created when MtProtoSender is created.
This thread constantly listens for Telegram updates (such as
incoming messages), so the updates can be received any time
rather than only when sending another request.
2016-09-09 11:47:37 +02:00
Lonami
e9e44795ec Attempt at removing cyclic dependencies 2016-09-08 16:55:46 +02:00
Lonami
b2425eeea9 Completely refactored unit tests, removed unused code 2016-09-08 16:11:37 +02:00
Lonami
a4f68dd29a Ability to retrieve message history, example improved
The example has been improved with more options (such as print
message history), and the TelegramClient now can retrieve the
message history from any given point in time or other offsets
2016-09-08 12:13:31 +02:00
Lonami
e6706080ad Improved TcpClient receive 2016-09-07 19:48:49 +02:00