2017-11-04 133 views
0

我想在與Python的Instagram的簡單的例子,沿着沿其readmeOAuthAccessTokenException-所提供的access_token無效

api = InstagramAPI(client_id=client_id, client_secret=client_secret) popular_media = api.media_popular(count=20) for media in popular_media: print media.images['standard_resolution'].url

然而,每次我試圖用我自己的client_id和client_secret我得到的時間下面的錯誤,並一直無法弄清楚如何解決它:

Traceback (most recent call last): File "/Users/PycharmProjects/Instagram API/InstaApiTest.py", line 10, in <module> popular_media = api.media_popular(count=20) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/instagram/bind.py", line 197, in _call return method.execute() File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/instagram/bind.py", line 189, in execute content, next = self._do_api_request(url, method, body, headers) File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/instagram/bind.py", line 163, in _do_api_request raise InstagramAPIError(status_code, content_obj['meta']['error_type'], content_obj['meta']['error_message']) instagram.bind.InstagramAPIError: (400) OAuthAccessTokenException-The access_token provided is invalid.

誰能幫我解決這個問題?

回答

0

這可能是由於教程已過時。請注意,在本教程回購的README file(已經多年沒有更新)警告說:

這個項目是不積極維護。繼續需要您自擔風險!

Instagram甚至不在media endpoints official documentation上列出media/popular/。即使是這樣的情況,也有some indication,即使是幾年前,您仍然需要一個實際訪問令牌,與您所遵循的教程相反。

TL; DR - 查找不同的教程,此端點已更改或需要完整身份驗證。