2016-07-26 81 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