以编程方式获取pip包的最新更新

以编程方式获取pip包的最新更新

本文介绍了以编程方式获取pip包的最新更新的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

(对于由于复制粘贴问题而引起此问题的标题的问题深表歉意)

( Apologies for an issue with the initial title of this question due to a copy paste issue)

在pypi.org上,我可以根据相关性或上次更新日期"来搜索软件包

On pypi.org I can search for packages by relevance or by "Date last updated"

我真正想要搜索的是相关性和日期最近更新",例如(少于)一年前.

What I'd really like to search for is by relevance and "Date last update" less than (for example) a year ago.

由于Web前端不提供此功能,所以我考虑编写一个小脚本来为我做这个事情.

As the web frontend doesn't provide this I thought about writing a small script doing this for me.

基本思路: -呼叫点搜索名称" -解析输出并通过api获取上次更改的日期,如果过旧则过滤 -尝试找到一种确定相关性的方法(也许只是使用 https://pypi.org/search /?q = searchword )

Basic idea: - call pip search "name" - parse the output and get via an api the last changed date and filter if too old - try to find a way to determine the relevance (perhaps just with https://pypi.org/search/?q=searchword )

交叉两个结果.

那么有人知道如何在pypi.org上获取给定python包(或包列表)的最后更改日期吗?

So does anybody know how to get the last change date on pypi.org for a given python package (or list of packages)?

推荐答案

您正在寻找 JSON API .项目没有上次修改日期,但是版本具有上载时间戳.所以是

You're looking for JSON API. Projects don't have last modification date but releases have upload timestamp. So it's

json["releases"][version][package_index]["upload_time"]

这篇关于以编程方式获取pip包的最新更新的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 05:34