Adding UserProfilePhotos doc and flake8 minor fixes

This commit is contained in:
Leandro Toledo 2015-07-08 10:14:07 -03:00
parent 0b19099eea
commit dadad120fc
3 changed files with 17 additions and 2 deletions

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python
# flake8: noqa
"""A library that provides a Python interface to the Telegram Bots API"""

View file

@ -389,6 +389,20 @@ class Bot(object):
user_id,
offset=None,
limit=100):
"""Use this method to get a list of profile pictures for a user.
Args:
user_id:
Unique identifier of the target user.
offset:
Sequential number of the first photo to be returned. By default,
all photos are returned. [Optional]
limit:
Limits the number of photos to be retrieved. Values between 1100
are accepted. Defaults to 100. [Optional]
Returns:
Returns a telegram.UserProfilePhotos object.
"""
url = '%s/getUserProfilePhotos' % (self.base_url)

View file

@ -17,9 +17,9 @@ class UserProfilePhotos(object):
from telegram import PhotoSize
photos = []
for photo in data['photos']:
photos.append([PhotoSize.newFromJsonDict(x) for x in photo])
photos.append([PhotoSize.newFromJsonDict(x) for x in photo])
else:
photos= None
photos = None
return UserProfilePhotos(total_count=data.get('total_count', None),
photos=photos)