本文整理汇总了Python中models.Group.parse方法的典型用法代码示例。如果您正苦于以下问题:Python Group.parse方法的具体用法?Python Group.parse怎么用?Python Group.parse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Group
的用法示例。
在下文中一共展示了Group.parse方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_parse_group
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import parse [as 别名]
def test_parse_group(self):
response = '''
{"response":[{"gid":1,"name":"ВКонтакте API","screen_name":"apiclub","is_closed":0,
"is_admin":1,"type":"group","photo":"http://cs400.vkontakte.ru/g00001/e_5ba03323.jpg",
"photo_medium":"http://cs400.vkontakte.ru/g00001/d_7bfe2183.jpg",
"photo_big":"http://cs400.vkontakte.ru/g00001/a_9a5cd502.jpg"},
{"gid":45,"name":"›››› ФМЛ 239 ››››","screen_name":"fml239","is_closed":1,"is_admin":0,"type":"group",
"photo":"http://cs39.vkontakte.ru/g00045/c_5a38eec.jpg",
"photo_medium":"http://cs39.vkontakte.ru/g00045/b_5a38eec.jpg",
"photo_big":"http://cs39.vkontakte.ru/g00045/a_5a38eec.jpg"}]}
'''
instance = Group()
instance.parse(json.loads(response)['response'][0])
instance.save()
self.assertEqual(instance.remote_id, 1)
self.assertEqual(instance.name, u'ВКонтакте API')
self.assertEqual(instance.screen_name, 'apiclub')
self.assertEqual(instance.is_closed, False)
self.assertEqual(instance.is_admin, True)
self.assertEqual(instance.type, 'group')
self.assertEqual(instance.photo, 'http://cs400.vkontakte.ru/g00001/e_5ba03323.jpg')
self.assertEqual(instance.photo_medium, 'http://cs400.vkontakte.ru/g00001/d_7bfe2183.jpg')
self.assertEqual(instance.photo_big, 'http://cs400.vkontakte.ru/g00001/a_9a5cd502.jpg')
示例2: _addStickTopic
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import parse [as 别名]
def _addStickTopic(self, webPage):
""" 访问小组首页,添加置顶贴
"""
#pdb.set_trace()
group = Group(self.group_id)
group.parse(webPage)
self.group_info = group
self.save_thread.putTask(self._saveGroupHandler, group)
示例3: test_parse_group
# 需要导入模块: from models import Group [as 别名]
# 或者: from models.Group import parse [as 别名]
def test_parse_group(self):
response = u'''[{
"uid": "53923499278353",
"name": "Группа для тестирования нового сервиса",
"description": "Группа для тестирования нового сервиса",
"shortname": "newservicetesting",
"picAvatar": "http://groupava2.odnoklassniki.ru/getImage?photoId=476991575825&photoType=4",
"shop_visible_admin": false,
"shop_visible_public": false,
"members_count": 12463
}]'''
instance = Group()
instance.parse(json.loads(response)[0])
instance.save()
self.assertEqual(instance.id, 53923499278353)
self.assertEqual(instance.name, u'Группа для тестирования нового сервиса')
self.assertEqual(instance.description, u'Группа для тестирования нового сервиса')
self.assertEqual(instance.shortname, 'newservicetesting')
self.assertEqual(instance.pic_avatar, 'http://groupava2.odnoklassniki.ru/getImage?photoId=476991575825&photoType=4')
self.assertEqual(instance.shop_visible_admin, False)
self.assertEqual(instance.shop_visible_public, False)
self.assertEqual(instance.members_count, 12463)