UploadProfilePhotoRequest

Only users can use this method. See code examples.

---functions---
photos.uploadProfilePhoto#89f30f69 flags:# fallback:flags.3?true file:flags.0?InputFile video:flags.1?InputFile video_start_ts:flags.2?double = photos.Photo

Returns

photos.Photo

This type can only be an instance of:

Photo

Parameters

fallbackflagThis argument defaults to None and can be omitted.
fileInputFileThis argument defaults to None and can be omitted.
videoInputFileThis argument defaults to None and can be omitted.
video_start_tsdoubleThis argument defaults to None and can be omitted.

Known RPC errors

This request can cause 7 known errors:

AlbumPhotosTooManyErrorToo many photos were included in the album.
FilePartsInvalidErrorThe number of file parts is invalid.
ImageProcessFailedErrorFailure while processing image.
PhotoCropSizeSmallErrorPhoto is too small.
PhotoExtInvalidErrorThe extension of the photo is invalid.
PhotoFileMissingError.
VideoFileInvalidErrorThe given video cannot be used.

You can import these from telethon.errors.

Example

from telethon.sync import TelegramClient
from telethon import functions, types

with TelegramClient(name, api_id, api_hash) as client:
    result = client(functions.photos.UploadProfilePhotoRequest(
        fallback=True,
        file=client.upload_file('/path/to/file.jpg'),
        video=client.upload_file('/path/to/file.mp4'),
        video_start_ts=7.13
    ))
    print(result.stringify())