mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 06:57:28 -06:00
Add script to easily gather packages hashes
This commit is contained in:
parent
5261936c4e
commit
ff6c8ee49a
1 changed files with 22 additions and 0 deletions
22
scripts/get_pypi_hashes.py
Executable file
22
scripts/get_pypi_hashes.py
Executable file
|
@ -0,0 +1,22 @@
|
|||
import requests
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
def get_package_wheel_hashes(package, version):
|
||||
url = f"https://pypi.org/pypi/{package}/{version}/json"
|
||||
data = requests.get(url).json()
|
||||
|
||||
print(f" {package}:")
|
||||
print(f" version: '{version}'")
|
||||
print(f" hashes:")
|
||||
|
||||
for url in data["urls"]:
|
||||
print(f" - sha256:{url['digests']['sha256']}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
parser = argparse.ArgumentParser(description="Display the hashes of the wheel files to be inserted in pip_requirements")
|
||||
parser.add_argument("package", type=Path, help="Name of the target package")
|
||||
parser.add_argument("version", type=Path, help="Version of the target package")
|
||||
args = parser.parse_args()
|
||||
get_package_wheel_hashes(args.package, args.version)
|
Loading…
Add table
Add a link
Reference in a new issue