Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class UserProfilePhotos(JsonDeserializable):
- @classmethod
- def de_json(cls, json_string):
- if (json_string is None):
- return None
- obj = cls.check_json(json_string)
- total_count = obj['total_count']
- photos = [[PhotoSize.de_json(y) for y in x] for x in obj['photos']]
- return cls(total_count, photos)
- def __init__(self, total_count, photos):
- self.total_count = total_count
- self.photos = photos
- class PhotoSize(JsonDeserializable):
- @classmethod
- def de_json(cls, json_string):
- if (json_string is None): return None
- obj = cls.check_json(json_string)
- file_id = obj['file_id']
- width = obj['width']
- height = obj['height']
- file_size = obj.get('file_size')
- return cls(file_id, width, height, file_size)
- def __init__(self, file_id, width, height, file_size=None):
- self.file_size = file_size
- self.height = height
- self.width = width
- self.file_id = file_id
- def get_user_profile_photos(self, user_id, offset=None, limit=None):
- """
- Retrieves the user profile photos of the person with 'user_id'
- See https://core.telegram.org/bots/api#getuserprofilephotos
- :param user_id:
- :param offset:
- :param limit:
- :return: API reply.
- """
- result = apihelper.get_user_profile_photos(self.token, user_id, offset, limit)
- return types.UserProfilePhotos.de_json(result)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement