Skip to content

Commit 5531057

Browse files
committed
calculates last modification date
1 parent 31bb3c6 commit 5531057

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

modified_time.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import requests
2+
import json
3+
from bs4 import BeautifulSoup
4+
5+
with open("all.json", "r") as f:
6+
all_packages = json.load(f)
7+
8+
packages = []
9+
10+
for package in all_packages:
11+
#print(package["package"])
12+
packages.append(package["package_name"])
13+
14+
packages = set(packages)
15+
16+
print(len(packages))
17+
18+
#Request pypu repository
19+
url = "https://pypi.org/project/"
20+
21+
dic = {}
22+
23+
for package in packages:
24+
try:
25+
print(package)
26+
page = requests.get(url+str(package))
27+
soup = BeautifulSoup(page.content, 'html.parser')
28+
dic[package] = soup.find_all("p", class_="package-header__date")[0].find("time")["datetime"])
29+
except:
30+
pass
31+
32+
with open("modified_date.json", "w") as f:
33+
json.dump(dic, f)
34+
35+

0 commit comments

Comments
 (0)