【问题标题】:Retrieving information from Instagram using an unauthenticated request?使用未经身份验证的请求从 Instagram 检索信息?
【发布时间】:2016-04-20 15:30:36
【问题描述】:

我正在尝试将 Instagram 与 Python 一起使用,但我在使用他们的 GitHub page. 上的股票示例时遇到了一个问题我完全按照第一个未经身份验证的请求部分中的步骤进行操作,我正在抛出以下错误。

我的代码:

from instagram.client import InstagramAPI

access_token = "..."
client_secret = "..."
client_id = "..."
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

错误:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/instagram/bind.py", line 197, in _call
    return method.execute()
  File "/Library/Python/2.7/site-packages/instagram/bind.py", line 189, in execute
    content, next = self._do_api_request(url, method, body, headers)
  File "/Library/Python/2.7/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.

任何帮助将不胜感激!同样,这段代码直接来自文档,所以我不确定它为什么不起作用。

【问题讨论】:

  • 你得到一个(404 - 未找到),github repo 可能使用了过时的 url

标签: python json python-2.7 instagram instagram-api


【解决方案1】:

根据 Instagram 开发者页面,

Instagram 平台和文档更新。在 2015 年 11 月 17 日或之后创建的应用将在沙盒模式下启动,并根据新更新的 API 速率限制和行为运行。”

因此,如果您在 2015 年 11 月 17 日之前创建应用,您将无法执行未经身份验证的请求。

如果您的应用是在 2015 年 11 月 17 日之前创建的,那么来自 python-instagram 页面的那些文档(最后一次更新是 9 个月前)已经过时了。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-07-05
    • 1970-01-01
    • 2016-03-22
    • 1970-01-01
    • 2021-05-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多