【发布时间】:2018-12-03 14:33:38
【问题描述】:
我正在使用
github developer API link 列出具有给定搜索词的所有存储库,我想按created_at 日期按降序对其进行排序。我该怎么做?
【问题讨论】:
标签: sorting github-api
我正在使用
github developer API link 列出具有给定搜索词的所有存储库,我想按created_at 日期按降序对其进行排序。我该怎么做?
【问题讨论】:
标签: sorting github-api
我自己找到了解决方案: 列出具有给定搜索词的存储库(例如 oauth):
response = https://api.github.com/search/repositories?q=oauth&order=desc
现在排序为
# Sort based on created_at date
data = sorted(response.json()['items'], key=lambda x: x['created_at'], reverse = True)
【讨论】: