【问题标题】:Instagram API facing errorInstagram API 面临错误
【发布时间】:2018-02-08 05:59:13
【问题描述】:

这是我在一些 github 中提到的 Instagram API 代码。但是我在使用 python 语言在 jupyter notebook 上运行时遇到错误。

from instagram.client import InstagramAPI
access_token = "6784563950.xxxxxxx.32e0d729b8c741508fbbcba17f8a7e57"
client_secret = "863bb1767xxxxxxx34861c31efe54104ae"
api = InstagramAPI(access_token=access_token, client_secret=client_secret)
recent_media, next_ = api.user_recent_media(user_id="67xxxx3950", count=10)
for media in recent_media: print(media)

我遇到了错误

"C:\Users\Balaji\Anaconda3\lib\site-packages\instagram\models.py 在 object_from_dictionary(cls,条目) 97 new_media.comment_count = entry['cmets']['count'] 98新媒体.cmets = [] ---> 99 用于在条目['cmets']['data'] 中进行评论: 100 new_media.cmets.append(评论.object_from_dictionary(评论)) 101 KeyError:“数据”。

谁能帮助我正确的代码?如果我写印刷媒体,它会说放括号。

【问题讨论】:

  • 请用您正在使用的编程语言标记您的问题,并删除不相关的标签:twitter-bootstrapfacebook

标签: instagram instagram-api


【解决方案1】:

官方客户端自 2016 年 6 月起已弃用。使用分叉和维护的客户端,例如:https://github.com/MabrianOfficial/python-instagram
安装它pip install --upgrade git+https://github.com/MabrianOfficial/python-instagram

【讨论】:

猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2015-09-04
  • 2023-01-11
  • 1970-01-01
  • 2015-04-23
  • 1970-01-01
  • 2015-08-13
  • 1970-01-01
相关资源
最近更新 更多