Can use and parse metadata information of vagrant box
Project description
python-vagrant-metadata
python-vagrant-metadata is a library for download vagrant box in vagrant cloud or customs site.
import requests
from vagrant_metadata import fetch, forge_metadata_url
metadata = fetch(forge_metadata_url('ubuntu/trusty64'))
url = metadata.url_for_youngest_version('virtualbox')
response = requests.get(url)
if response.ok:
with open('mybox.box', 'wb') as f:
f.write(response.content)
If you need the checksum of box for specific versions, you can use provider as like
import requests
from vagrant_metadata import fetch, forge_metadata_url
metadata = fetch(forge_metadata_url('ubuntu/trusty64'))
url = metadata.url_for('20190514.0.0','virtualbox')
response = requests.get(url)
if response.ok:
with open('mybox.box', 'wb') as f:
f.write(response.content)
If you need the checksum of box, you can use provider as like
from vagrant_metadata import fetch, forge_metadata_url
metadata = fetch(forge_metadata_url('ubuntu/trusty64'))
provider = metadata.youngest()['virtualbox']
print(provider.url)
print(provider.checksum)
If you need the checksum of box for specific versions, you can use provider as like
from vagrant_metadata import fetch, forge_metadata_url
metadata = fetch(forge_metadata_url('ubuntu/trusty64'))
provider = metadata['20190514.0.0']['virtualbox']
print(provider.url)
print(provider.checksum)
If you want only version with the specific provider, you can filtering as like
from vagrant_metadata import fetch, forge_metadata_url
metadata = fetch(forge_metadata_url('ubuntu/trusty64'))
provider = metadata.keep_only_provider('virtualbox').youngest()['virtualbox']
print(provider.url)
print(provider.checksum)
Build package
python3 setup.py bdist_wheel
python3 -m twine upload --skip-existing --repository testpypi dist/*
python3 -m pip install --index-url https://test.pypi.org/simple/ python-vagrant-metadata
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for python-vagrant-metadata-0.0.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 98c4355ce7f026c5d9ddd9aa58b249b2e83ab41d2d96a85bc7be7314569426b2 |
|
MD5 | 6a41885c8eea5d0b4c29d0dbdb260792 |
|
BLAKE2b-256 | 47c923c16e69ea67c5efe423da79deb12b33a115054cf4d372c1e90f4dd59f4c |
Close
Hashes for python_vagrant_metadata-0.0.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67abf8d5b53a6185c111d3dcaa11e39ced6b3d4e57204821652ce96362e878c9 |
|
MD5 | 7dd2836cefb2b6523d1e9f014f48d06a |
|
BLAKE2b-256 | c80cf3635d6d2e0a27dfaf787925a36c1911a865f063cf0284caa58cece790fe |