From b4b53735050191642fc0f025c69af2339c1a38c3 Mon Sep 17 00:00:00 2001 From: Dan <14043624+delivrance@users.noreply.github.com> Date: Mon, 16 Apr 2018 11:49:00 +0200 Subject: [PATCH] Deprecate download_photo --- docs/source/pyrogram/Client.rst | 1 - pyrogram/client/client.py | 43 --------------------------------- 2 files changed, 44 deletions(-) diff --git a/docs/source/pyrogram/Client.rst b/docs/source/pyrogram/Client.rst index b626e745..806950a8 100644 --- a/docs/source/pyrogram/Client.rst +++ b/docs/source/pyrogram/Client.rst @@ -35,7 +35,6 @@ Client send_chat_action send_sticker download_media - download_photo get_user_profile_photos edit_message_text edit_message_caption diff --git a/pyrogram/client/client.py b/pyrogram/client/client.py index cb3c30d6..2e43ac9f 100644 --- a/pyrogram/client/client.py +++ b/pyrogram/client/client.py @@ -3099,49 +3099,6 @@ class Client: return path[0] - def download_photo(self, - photo: types.Photo or types.UserProfilePhoto or types.ChatPhoto, - file_name: str = "", - block: bool = True): - """Use this method to download a photo not contained inside a Message. - For example, a photo of a User or a Chat/Channel. - - Args: - photo (:obj:`Photo ` | :obj:`UserProfilePhoto ` | :obj:`ChatPhoto `): - The photo object. - - file_name (``str``, optional): - A custom *file_name* to be used instead of the one provided by Telegram. - By default, all photos are downloaded in the *downloads* folder in your working directory. - You can also specify a path for downloading photos in a custom location: paths that end with "/" - are considered directories. All non-existent folders will be created automatically. - - block (``bool``, optional): - Blocks the code execution until the photo has been downloaded. - Defaults to True. - - Returns: - On success, the absolute path of the downloaded photo as string is returned, None otherwise. - - Raises: - :class:`Error ` - """ - if isinstance(photo, (types.UserProfilePhoto, types.ChatPhoto)): - photo = types.Photo( - id=0, - access_hash=0, - date=int(time.time()), - sizes=[types.PhotoSize( - type="", - location=photo.photo_big, - w=0, - h=0, - size=0 - )] - ) - - return self.download_media(photo, file_name, block) - def add_contacts(self, contacts: list): """Use this method to add contacts to your Telegram address book.