Skip to content

Commit 9a80570

Browse files
committed
Allow uploading profile photos using file-like objects
1 parent aaedeff commit 9a80570

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

pyrogram/client/methods/users/set_profile_photo.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,26 @@
1818

1919
from pyrogram.api import functions
2020
from ...ext import BaseClient
21+
from typing import Union, BinaryIO
2122

2223

2324
class SetProfilePhoto(BaseClient):
2425
def set_profile_photo(
2526
self,
26-
photo: str
27+
photo: Union[str, BinaryIO]
2728
) -> bool:
2829
"""Set a new profile photo.
2930
31+
If you want to set a profile video instead, use :meth:`~Client.set_profile_video`
32+
3033
This method only works for Users.
3134
Bots profile photos must be set using BotFather.
3235
3336
Parameters:
3437
photo (``str``):
3538
Profile photo to set.
36-
Pass a file path as string to upload a new photo that exists on your local machine.
39+
Pass a file path as string to upload a new photo that exists on your local machine or
40+
pass a binary file-like object with its attribute ".name" set for in-memory uploads.
3741
3842
Returns:
3943
``bool``: True on success.

0 commit comments

Comments
 (0)