Document save_file
This commit is contained in:
parent
c907e8146a
commit
64ec26850e
@ -19,7 +19,7 @@ Utilities
|
|||||||
remove_handler
|
remove_handler
|
||||||
send
|
send
|
||||||
resolve_peer
|
resolve_peer
|
||||||
download_media
|
save_file
|
||||||
|
|
||||||
Decorators
|
Decorators
|
||||||
----------
|
----------
|
||||||
|
@ -1116,9 +1116,9 @@ class Client(Methods, BaseClient):
|
|||||||
peer_id: Union[int, str]):
|
peer_id: Union[int, str]):
|
||||||
"""Use this method to get the InputPeer of a known peer_id.
|
"""Use this method to get the InputPeer of a known peer_id.
|
||||||
|
|
||||||
This is a utility method intended to be used only when working with Raw Functions (i.e: a Telegram API method
|
This is a utility method intended to be used **only** when working with Raw Functions (i.e: a Telegram API
|
||||||
you wish to use which is not available yet in the Client class as an easy-to-use method), whenever an InputPeer
|
method you wish to use which is not available yet in the Client class as an easy-to-use method), whenever an
|
||||||
type is required.
|
InputPeer type is required.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
peer_id (``int`` | ``str``):
|
peer_id (``int`` | ``str``):
|
||||||
@ -1191,6 +1191,51 @@ class Client(Methods, BaseClient):
|
|||||||
file_part: int = 0,
|
file_part: int = 0,
|
||||||
progress: callable = None,
|
progress: callable = None,
|
||||||
progress_args: tuple = ()):
|
progress_args: tuple = ()):
|
||||||
|
"""Use this method to upload a file onto Telegram servers, without actually sending the message to anyone.
|
||||||
|
|
||||||
|
This is a utility method intended to be used **only** when working with Raw Functions (i.e: a Telegram API
|
||||||
|
method you wish to use which is not available yet in the Client class as an easy-to-use method), whenever an
|
||||||
|
InputFile type is required.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
path (``str``):
|
||||||
|
The path of the file you want to upload that exists on your local machine.
|
||||||
|
|
||||||
|
file_id (``int``, *optional*):
|
||||||
|
In case a file part expired, pass the file_id and the file_part to retry uploading that specific chunk.
|
||||||
|
|
||||||
|
file_part (``int``, *optional*):
|
||||||
|
In case a file part expired, pass the file_id and the file_part to retry uploading that specific chunk.
|
||||||
|
|
||||||
|
progress (``callable``, *optional*):
|
||||||
|
Pass a callback function to view the upload progress.
|
||||||
|
The function must take *(client, current, total, \*args)* as positional arguments (look at the section
|
||||||
|
below for a detailed description).
|
||||||
|
|
||||||
|
progress_args (``tuple``, *optional*):
|
||||||
|
Extra custom arguments for the progress callback function. Useful, for example, if you want to pass
|
||||||
|
a chat_id and a message_id in order to edit a message with the updated progress.
|
||||||
|
|
||||||
|
Other Parameters:
|
||||||
|
client (:obj:`Client <pyrogram.Client>`):
|
||||||
|
The Client itself, useful when you want to call other API methods inside the callback function.
|
||||||
|
|
||||||
|
current (``int``):
|
||||||
|
The amount of bytes uploaded so far.
|
||||||
|
|
||||||
|
total (``int``):
|
||||||
|
The size of the file.
|
||||||
|
|
||||||
|
*args (``tuple``, *optional*):
|
||||||
|
Extra custom arguments as defined in the *progress_args* parameter.
|
||||||
|
You can either keep *\*args* or add every single extra argument in your function signature.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
On success, the uploaded file is returned in form of an InputFile object.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
:class:`Error <pyrogram.Error>` in case of a Telegram RPC error.
|
||||||
|
"""
|
||||||
part_size = 512 * 1024
|
part_size = 512 * 1024
|
||||||
file_size = os.path.getsize(path)
|
file_size = os.path.getsize(path)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user