【问题标题】:not valid JSON python-instagram无效的 JSON python-instagram
【发布时间】:2016-07-26 16:50:53
【问题描述】:

我就是无法开始使用 instagram api。

来自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(最近一次调用最后一次):

文件 ...Python35-32\lib\site-packages\simplejson\decoder.py",行 400,在 raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.scanner.JSONDecodeError:期望值:第 1 行第 1 列 (字符 0)

在处理上述异常的过程中,又发生了一个异常:

Traceback(最近一次调用最后一次):

文件 "C:\Users\PolyProgrammist\AppData\Local\Programs\Python\Python35-32\lib\site-packages\instagram\bind.py", 第 131 行,在 _do_api_request raise InstagramClientError('Unable to parse response, not valid JSON.', status_code=response['status']) instagram.bind.InstagramClientError:(404)无法解析响应, 无效的 JSON。

【问题讨论】:

    标签: python json instagram-api


    【解决方案1】:

    我怀疑这与 Instagram 于 6 月 1 日制定的最近强制执行权限审查(我认为这会改变身份验证)有关。 https://www.instagram.com/developer/changelog/

    鉴于 python-instagram 库自 march 以来尚未更新,它可能已过时并且无法正确处理身份验证错误。

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

    【讨论】:

    • 那我该怎么办?我只想使用 inst api(获取订阅列表或喜欢一些帖子)我该怎么做
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-11-07
    • 1970-01-01
    • 2016-10-03
    • 1970-01-01
    • 1970-01-01
    • 2015-10-05
    • 1970-01-01
    相关资源
    最近更新 更多