2016-07-26 83 views
0

我只是不能开始使用instagram api。无效JSON python-instagram

从GitHub代码https://github.com/facebookarchive/python-instagram

from instagram.client import InstagramAPI 

access_token = "***" 
client_secret = "***" 
scope = 'public_content' 
api = InstagramAPI(access_token=access_token, client_secret=client_secret) 
recent_media, next_ = api.user_recent_media(user_id = "***", count=10) 
for media in recent_media: 
    print("hey") 

错误:

Traceback (most recent call last):

File ...Python35-32\lib\site-packages\simplejson\decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.scanner.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

在处理上述异常,另一个异常:

Traceback (most recent call last):

File "C:\Users\PolyProgrammist\AppData\Local\Programs\Python\Python35-32\lib\site-packages\instagram\bind.py", line 131, in _do_api_request raise InstagramClientError('Unable to parse response, not valid JSON.', status_code=response['status']) instagram.bind.InstagramClientError: (404) Unable to parse response, not valid JSON.

回答

0

我怀疑这事做与最近执行许可审查(我认为改变认证),Instagram于6月1日放下。 https://www.instagram.com/developer/changelog/

鉴于python-instagram库自march以来没有更新过,所以它可能已过时并且不能正确处理验证错误。

我的猜测是,instagram API正在返回一个JSON格式的错误,这导致simplejson抛出该异常。

+0

那我该怎么办?我想只使用inst api(获取订阅列表或像一些帖子)我该怎么做 – PolyProgrammist