我知道這已經被問到過了..但是我的代碼似乎不適用於創建訪問權限的用戶以外的其他用戶 .. ie I am只能訪問一個用戶的個人資料。(使用我所創建的accessToken)使用Instagram API在Instagram中獲取用戶的關注者數量
from urllib2 import urlopen
from json import load
import json
import json
import sys
import time
import requests
userid="userid_of_some_instagram_user"
access_token="mytoken"
url = "https://api.instagram.com/v1/users/%s/?access_token=%s"%(userid,access_token)
response=urlopen(url)
print(response)
jsonobj=load(response)
print "name:",jsonobj["data"]["username"]
print "follows ",jsonobj["data"]["counts"]["follows"]," people"
print "followed by ",jsonobj["data"]["counts"]["followed_by"]," people"
錯誤,當我試圖訪問其他的配置文件,我得到的是
HTTPError: HTTP Error 400: BAD REQUEST
Edit : **Voila ! I have found the bug . It is the access key. I have tried with a different access key . It worked**
可以嘗試[/users/self](https://www.instagram .com/developer/endpoints/users /#get_users_self)? – walkingRed
@walkingRed:我們不能指定userid當使用自我..如何幫助 – MysticForce
我可能會發現解決方案:[Instagram-python](https://github.com/Instagram/python-instagram) – walkingRed