我试图通过使用Python的API包装器获取我在Instagram上发布的最新照片的信息here.
它基于这种用法:
api.user_recent_media(user_id, count, max_id)
所以我这样做了:
last_post = api.user_recent_media(user_id,1,1)
print last_post
我得到了:
Followers: 7 (+0)
Traceback (most recent call last):
File "get_ig_follower_count.py", line 52, in <module>
last_post = api.user_recent_media(user_id,2,3)
File "B:\MegaSync\Programming\Python\AonnixPromo\lib\site-packages\instagram\b
ind.py", line 197, in _call
return method.execute()
File "B:\MegaSync\Programming\Python\AonnixPromo\lib\site-packages\instagram\b
ind.py", line 189, in execute
content, next = self._do_api_request(url, method, body, headers)
File "B:\MegaSync\Programming\Python\AonnixPromo\lib\site-packages\instagram\b
ind.py", line 163, in _do_api_request
raise InstagramAPIError(status_code, content_obj['meta']['error_type'], cont
ent_obj['meta']['error_message'])
instagram.bind.InstagramAPIError: (400) APINotFoundError-this user does not exis
t
正如您在顶部看到的那样,我的api和user_id工作正常,因为他们成功检索了我的关注者数量。
该帐户也是沙盒的管理员。
答案 0 :(得分:0)
您处于沙盒模式,因此您必须将要通过API访问的用户添加到沙盒授权列表。
Go to instagram.com/developer > Manage Client > Edit > Sandbox tab > type username and Enter > click "Save Changes"
如果您访问的用户不在沙箱用户列表中,则会返回错误消息:“此用户不存在”
{"meta":{"error_type":"APINotFoundError","code":400,"error_message":"this user does not exist"}}