Commit Graph

533 Commits

Author SHA1 Message Date
Dan
1737ba5f49 Revamp docs about the main Pyrogram package 2019-05-09 04:28:46 +02:00
Dan
bd9bb83df5 Reword some methods' docstring 2019-05-07 18:26:27 +02:00
Dan
591499121f Add an hint about which client is loading the plugins 2019-05-06 17:40:40 +02:00
Dan
63d76a7f13 Bring back automatic mime type detection for new uploads (fixes #239)
- Add mime.types file to contain a good database of type -> ext mappings
  from svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types

- Load mime.type at BaseClient creation and add two convenience methods
  for guessing mime types from filenames and extensions from mime types,
  guess_mime_type and guess_extension

- Make all send_* method as well as download_media use the new mime type
  database via guess_mime_type and guess_extension methods
2019-04-20 18:56:30 +02:00
bakatrouble
952f0627f1 Merge branch 'develop' into session_storage
# Conflicts:
#	pyrogram/client/client.py
#	pyrogram/client/ext/base_client.py
#	pyrogram/client/ext/syncer.py
#	pyrogram/client/style/html.py
#	pyrogram/client/style/markdown.py
2019-04-14 21:49:45 +03:00
Dan
4d1abbbb79 Make the deprecation warning actually work 2019-04-13 14:41:14 +02:00
Dan
b5c6db6db0 Refactor project and move errors namespace out from pyrogram.api 2019-03-25 11:23:45 +01:00
Dan
5edd971118 Update docs to use bot_token parameter 2019-03-22 12:39:15 +01:00
bakatrouble
5aa93b8287 Show TOS on signup just once while program is running (#231) 2019-03-20 14:20:38 +01:00
Dan
34b51b6481 Force keyword arguments for all TL types 2019-03-16 16:53:52 +01:00
Dan
a0e48572cb Merge branch 'develop' into layer-95 2019-03-13 10:05:31 +01:00
Dan
64775f5209 Fix "ModuleNotFoundError is not defined" error for Python <3.6 2019-03-04 12:50:42 +01:00
bakatrouble
85700b0ffc Do not cache entities without access_hash 2019-03-01 21:23:53 +03:00
Dan
ffa0da5800 Merge branch 'develop' into layer-95
# Conflicts:
#	pyrogram/__init__.py
2019-03-01 18:38:27 +01:00
bakatrouble
f84f9ec4df Add bot_token argument (#221)
* Add bot_token argument (closes #123)

* Make session_name docs more readable and detailed

* Explicitely set is_bot=False
2019-03-01 18:30:39 +01:00
bakatrouble
5874e521ba Merge remote-tracking branch 'pyrogram/develop' into session_storage 2019-03-01 19:43:02 +03:00
bakatrouble
b0c011c70c Fix plugins import on windows (#223)
Fixes #217
2019-02-27 22:27:50 +01:00
bakatrouble
10fc340eff Add session migrating from json; add some indexes to sqlite sessions 2019-02-26 21:43:23 +03:00
bakatrouble
03b92b3302 Implement SQLite session storage 2019-02-26 21:06:30 +03:00
bakatrouble
260043d8ec Unify peers cache 2019-02-26 19:24:00 +03:00
bakatrouble
5dc33c6337 add in-memory session storage, refactor session storages, remove mixin 2019-02-22 03:37:19 +03:00
bakatrouble
9c4e9e166e Merge #221, string sessions now work for bots too 2019-02-22 02:13:51 +03:00
bakatrouble
fd5889d69e Merge branch 'bot_token_arg' into session_storage
# Conflicts:
#	pyrogram/client/client.py
#	pyrogram/client/ext/base_client.py
#	pyrogram/client/ext/syncer.py
2019-02-22 01:59:21 +03:00
bakatrouble
5cc9a452eb Add bot_token argument (closes #123) 2019-02-22 01:34:08 +03:00
bakatrouble
fd732add70 Refactor session storages: use session_name arg to detect storage type 2019-02-22 00:03:58 +03:00
bakatrouble
431a983d5b Fix logging and cleanup imports in client.py 2019-02-21 21:18:53 +03:00
bakatrouble
9d32b28f94 Implement extendable session storage and JSON session storage 2019-02-21 20:12:11 +03:00
Dan
712b390f77 Add a retry mechanism when uploading chunks 2019-02-05 17:10:00 +01:00
Dan
249e405339 Update API schema to Layer 95 2019-02-03 11:03:11 +01:00
Dan
628ddd4a25 Update Client's docstrings 2019-01-27 11:24:23 +01:00
Dan
a8a6f53e2d Fix the configuration load process breaking in case of no plugins 2019-01-26 13:01:44 +01:00
Dan
be013de4d4 Fix plugins load via Client parameter 2019-01-16 20:25:48 +01:00
Dan
6ec3b12aeb Smart plugins enhancements 2019-01-16 15:54:48 +01:00
Dan
3d16a715ad Fix file using wrong line separator 2019-01-16 15:46:46 +01:00
Dan
6df7788379 Enhance proxy settings
- Allow proxy settings to omit "enabled" key
- Allow setting proxy to None in order to disable it
2019-01-16 13:10:01 +01:00
Dan
b37d4dc7ec Make get_file and save_file handle StopTransmission errors 2019-01-11 14:03:16 +01:00
Dan
6b63e88de7 Add Client.stop_transmission() method
As a wrapper for raise StopTransmission
2019-01-11 14:02:40 +01:00
Dan
200ed844fe Fix first_name and last_name not being called if they are callable 2019-01-11 13:02:19 +01:00
Dan
07276e31b9 Add restart method 2019-01-11 12:36:37 +01:00
Dan
66f70450aa Allow phone_number, phone_code and password to also be functions
Also add recovery_code
References #163
2019-01-08 14:28:52 +01:00
Dan
4f6990d735 Add takeout parameter in Client
This lets the client use a takeout session instead of a normal one.
Takeout sessions are useful for exporting Telegram data. Methods invoked
inside a takeout session are less prone to throw FloodWait exceptions.
2019-01-03 12:20:42 +01:00
Dan
b53ba81a6a Add no_updates parameter in Client
Useful to completely disable incoming updates for batch programs
2019-01-03 11:13:24 +01:00
Dan
4d7b1bafac Update copyright year 2019-01-01 12:36:16 +01:00
Dan
64ec26850e Document save_file 2018-12-28 15:16:46 +01:00
Dan
d91acfe2ca Re-implement password-protected log-ins and support password recovery 2018-12-25 15:41:55 +01:00
Dan
fccadf526e Merge branch 'develop' into future
# Conflicts:
#	pyrogram/__init__.py
2018-12-25 14:36:59 +01:00
Dan
00e4e385aa Allow bots to message old chats even if they don't exist in the session 2018-12-24 22:31:45 +01:00
Dan
84fef9ecf1 Add missing file_reference argument where applicable 2018-12-23 00:55:00 +01:00
Dan
bf0b947253 Type hint all Client methods 2018-12-19 14:55:48 +01:00
Dan
8f6f38e0b0 Merge branch 'develop' into new-parsers 2018-12-18 11:22:47 +01:00
Dan
bc824f738c Add extra warnings when sign-ins or sign-ups fail 2018-12-18 11:21:37 +01:00
Dan
c9bcf93cf7 Add extra checks in case sign-in or sign-up fails 2018-12-18 10:10:04 +01:00
Dan
914dfca574 Reformat code and optimize imports 2018-12-18 09:50:39 +01:00
Dan
70470360b1 Print account name when logging in the first time 2018-12-15 11:10:25 +01:00
Dan
001a067d82 Make start and stop methods return self to make chaining possible
Suggestion by @CharlesBachman in Telegram
2018-12-15 09:50:35 +01:00
Dan
4ba5e63034 Report offset instead of 0 in case file size is missing (for file_id) 2018-12-15 08:51:20 +01:00
Dan
9c91720104 Fix broken download_media progress args 2018-12-15 08:50:08 +01:00
Dan
e400641204 Fix Dispatcher bad behaviours in case of multiple Clients running at the same time. 2018-11-13 20:31:53 +01:00
Dan
c006ba5b30
Merge pull request #146 from TolichP/add-filesize-limit-error
Add file size limit error
2018-11-03 11:11:06 +01:00
Dan
09563067c7
Add a check for 0 B file sizes 2018-11-03 11:10:43 +01:00
Dan
45129658b0 Revisit docstrings 2018-11-03 10:49:11 +01:00
Dan
99bdaae365 Allow nested folders for smart plugins 2018-10-23 15:43:49 +02:00
Dan
a0780d793d Apply code review suggestions 2018-10-21 14:44:29 +07:00
Dan
1fe46610cd Make plugins disabled by default
Users need to explicitly set plugins_dir parameter
2018-10-21 09:42:22 +02:00
Alexandr
ee47c21eed Add file size limit error 2018-10-19 23:39:29 +07:00
Dan
f4146a8779 Accept None as plugins_dir 2018-10-13 19:33:43 +02:00
Dan
8e238ccc9a Add plugins_dir docstrings in Client class definition 2018-10-13 11:14:26 +02:00
Dan
345ac6e16a Merge branch 'develop' into plugins 2018-10-13 10:42:07 +02:00
Dan
9649b1457c Don't make use of hardcoded default int values too 2018-10-13 10:41:58 +02:00
Dan
340fb9c145 Merge branch 'develop' into plugins
# Conflicts:
#	pyrogram/client/client.py
#	pyrogram/client/ext/base_client.py
2018-10-13 10:39:47 +02:00
Dan
a32009a79d Don't make use of hardcoded default string values 2018-10-13 10:38:44 +02:00
Dan
6a0066b8b5 Move loading plugins logic into a separate method 2018-10-12 17:57:34 +02:00
Dan
4bb50ee35f More logs when loading plugins 2018-10-12 17:54:52 +02:00
Dan
6c05f9ff42 Sanitize (a bit) plugins directory 2018-10-12 15:26:52 +02:00
Dan
4e516d097f Don't raise exceptions in case of non-existent plugins folder
Don't even warn in case the default plugins folder doesn't exist
2018-10-12 14:32:35 +02:00
Dan
0b79f96b4f Turn hardcoded plugins dir into a constant 2018-10-12 14:19:26 +02:00
Dan
dfb841baa9 Automatically scan and load plugins from a customizable directory
Defined functions found inside the directory that are also decorated
properly will be registered in the Client's dispatcher as handlers.
2018-10-12 14:17:03 +02:00
Dan
b79bd1ea83 Don't swallow left_chat_member updates
Even though they are only relevant for supergroups with <50 members
2018-10-01 09:45:32 +02:00
Dan
12c61fb431 Fix unwanted CHANNEL_PRIVATE errors. Fixes #129 2018-10-01 09:40:34 +02:00
Dan
6a89c7ea02 Add missing ipv6 docstrings 2018-09-22 14:21:55 +02:00
Dan
3a858e6a57 Fix config values not being available when not using config.ini file 2018-09-19 17:30:23 +02:00
Dan
8b364202c3 Use list instead of set 2018-09-18 19:17:28 +02:00
Dan
500ec09b47 Clean up load_config 2018-09-18 19:16:55 +02:00
Dan
f850d6352e Enhance API by adding support for Context Managers. Closes #122
A batch script would be as simple as this example:

from pyrogram import Client

with Client("...") as app:
    app.send_message("haskell", "hi")
2018-09-17 18:53:04 +02:00
Dan
e7a85520f2 Merge remote-tracking branch 'origin/develop' into develop
# Conflicts:
#	pyrogram/client/client.py
2018-09-17 15:59:49 +02:00
Dan
c75a4f182a
Handle Telegram exceptions on start(). Fixes #121
The client doesn't need to be stopped as it never started successfully.
2018-09-15 13:23:25 +02:00
Dan
db6042e91b Fetch ChatForbidden and ChannelForbidden peers
This fixes unwanted PEER_ID_INVALID errors in cases where a user or a
bot was kicked/banned from a group, supergroup or channel
2018-09-02 13:04:29 +02:00
Dan
9f4d7854e8 Fix ipv6 branch merge mess 2018-08-30 01:23:19 +02:00
Dan
4b3b647245 Merge branch 'ipv6' into develop
# Conflicts:
#	pyrogram/client/client.py
#	pyrogram/session/session.py
2018-08-28 12:19:37 +02:00
Dan
2779e33d13 Rename "token" to "bot_token" 2018-09-10 19:55:53 +02:00
Dan
da436461a8 Revert "Move resolve_peer into utilities"
This reverts commit 6437c6c
2018-08-10 11:29:13 +02:00
Dan
6437c6c5be Move resolve_peer into utilities 2018-08-10 11:17:53 +02:00
Dan
d270d0d2aa Remove support for t.me/joinchat/ links in resolve_peer for now
Another way, which is 100% reliable, will be implemented
Also clean the method a bit by removing useless checks
2018-07-28 23:09:44 +02:00
Dan
0c96fa8b7c Don't flush each chunk. Let python/os deal with it 2018-07-11 17:05:33 +02:00
Dan
1d7c857e9f Rename get_dialogs 2018-07-04 21:02:26 +02:00
Dan
52f1f390ca Rename get_dialogs 2018-07-04 20:59:21 +02:00
Dan
8bdccda6ee Fix GetDialog call 2018-07-04 14:03:45 +02:00
Dan
c7489cf302 Reformat code 2018-07-04 14:03:14 +02:00
Dan
29fb0ce599 Also log UpdatesTooLong 2018-07-04 13:53:34 +02:00
Dan
e414956e71
Log UpdateChannelTooLong updates 2018-07-03 18:29:25 +02:00