python-telegram-bot/telegram/userprofilephotos.py
2015-07-08 10:14:07 -03:00

25 lines
739 B
Python

#!/usr/bin/env python
class UserProfilePhotos(object):
def __init__(self, **kwargs):
param_defaults = {
'total_count': None,
'photos': None
}
for (param, default) in param_defaults.iteritems():
setattr(self, param, kwargs.get(param, default))
@staticmethod
def newFromJsonDict(data):
if 'photos' in data:
from telegram import PhotoSize
photos = []
for photo in data['photos']:
photos.append([PhotoSize.newFromJsonDict(x) for x in photo])
else:
photos = None
return UserProfilePhotos(total_count=data.get('total_count', None),
photos=photos)