Skip to content

Instantly share code, notes, and snippets.

@ThomasG77
Created July 17, 2026 18:36
Show Gist options
  • Select an option

  • Save ThomasG77/fc0191b92c38e01cf9910480fc44e432 to your computer and use it in GitHub Desktop.

Select an option

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
# 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