Created
July 17, 2026 18:36
-
-
Save ThomasG77/fc0191b92c38e01cf9910480fc44e432 to your computer and use it in GitHub Desktop.
Get remote URL of a compressed Pypi package when not available on Github
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Get Python library sources latest version url when not available on github | |
| from bs4 import BeautifulSoup | |
| import requests | |
| packages = ['to-file-like-obj', 'stream-zip', 'stream-unzip'] | |
| for package in packages: | |
| r = requests.get(f'https://pypi.org/simple/{package}/') | |
| soup = BeautifulSoup(r.text, "html.parser") | |
| last_version = soup.find('body').find_all('a')[-1] | |
| last_version_name = last_version.text | |
| dict_last_version = last_version.attrs | |
| dict_last_version['last_version_name'] = last_version_name | |
| print(dict_last_version) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment