【发布时间】:2016-02-25 06:44:20
【问题描述】:
我正在使用 Python 的 python-instagram 库来访问 Instagram API 的 users/user-id 端点:
根据文档,这是上述端点生成的理想响应:
{
"data": {
"id": "1574083",
"username": "snoopdogg",
"full_name": "Snoop Dogg",
"profile_picture": "http://distillery.s3.amazonaws.com/profiles/profile_1574083_75sq_1295469061.jpg",
"bio": "This is my bio",
"website": "http://snoopdogg.com",
"counts": {
"media": 1320,
"follows": 420,
"followed_by": 3410
}
}
现在,我正在尝试从生成的响应中查找与counts 属性关联的数据:
from instagram.client import InstagramAPI
access_token = <my_access_token>
api = InstagramAPI(client_secret='xxxxxxxx', access_token = access_token[0])
usr = api.user_search('XXXXX')
print usr[0].counts
但是,我遇到了以下错误:
AttributeError: 'User' object has no attribute 'counts'
我的代码似乎有什么问题?
【问题讨论】:
标签: python python-2.7 instagram python-2.x instagram-api