Skip to content

Commit

Permalink
Cache PyPI responses for one hour
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Sep 5, 2024
1 parent a41208f commit 8cf3a56
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ node_modules
history.jsonl
history.png
python-eol.json
requests-cache.sqlite
results*.json
top-pypi-packages.json
wheel*.png
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ gitpython
jsonlines
matplotlib
packaging
requests
requests-cache
termcolor
tqdm
5 changes: 3 additions & 2 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import json
import os

import requests
import requests_cache
from packaging import specifiers
from zoneinfo import ZoneInfo # Python 3.9+

Expand Down Expand Up @@ -73,7 +73,8 @@
"pypular",
}

SESSION = requests.Session()
# Keep responses for one hour
SESSION = requests_cache.CachedSession("requests-cache", expire_after=60 * 60)

CLASSIFIER = "Programming Language :: Python :: {}"

Expand Down

0 comments on commit 8cf3a56

Please sign in to comment.