Created
July 25, 2020 16:25
-
-
Save xnuinside/1c9e0c9793ad2c9573496c29ab5aa8ec to your computer and use it in GitHub Desktop.
This file contains 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
def request_package_info_from_pypi(package_name): | |
result = requests.get( | |
f"https://pypi.org/pypi/{package_name}/json").json() | |
info = result["info"] | |
output = f'<i>{datetime.now().date()} Random Package from PyPi\n</i>' \ | |
f'<b>Package name:</b> {package_name}\n' \ | |
f'<b>Short description:</b> {info["summary"]}\n' \ | |
f'<b>Latest version:</b> {info["version"]}\n' \ | |
f'<b>Release date:</b> {result["releases"][info["version"]][0]["upload_time"].split("T")[0]}\n' \ | |
f'<b>Author:</b> {info["author"]}\n' \ | |
f'<b>Homepage:</b> {info["project_urls"]["Homepage"]}\n' \ | |
f'<b>Python versions:</b> {info["requires_python"]}' | |
return output |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment