iter_profile_photos()

Client.iter_profile_photos()

Iterate through a chat or a user profile photos sequentially.

This convenience method does the same as repeatedly calling get_profile_photos() in a loop, thus saving you from the hassle of setting up boilerplate code. It is useful for getting all the profile photos with a single call.

Parameters
  • chat_id (int | str) – Unique identifier (int) or username (str) of the target chat. For your personal cloud (Saved Messages) you can simply use “me” or “self”. For a contact that exists in your Telegram address book you can use his phone number (str).

  • limit (int, optional) – Limits the number of profile photos to be retrieved. By default, no limit is applied and all profile photos are returned.

  • offset (int, optional) – Sequential number of the first profile photo to be returned.

Returns

Generator – A generator yielding Photo objects.

Example

for photo in app.iter_profile_photos("haskell"):
    print(photo.file_id)