Skip to main content

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

python-vagrant-metadata-0.0.5.tar.gz (17.6 kB view details)

Uploaded Source

Built Distribution

python_vagrant_metadata-0.0.5-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file python-vagrant-metadata-0.0.5.tar.gz.

File metadata

File hashes

Hashes for python-vagrant-metadata-0.0.5.tar.gz
Algorithm Hash digest
SHA256 98c4355ce7f026c5d9ddd9aa58b249b2e83ab41d2d96a85bc7be7314569426b2
MD5 6a41885c8eea5d0b4c29d0dbdb260792
BLAKE2b-256 47c923c16e69ea67c5efe423da79deb12b33a115054cf4d372c1e90f4dd59f4c

See more details on using hashes here.

File details

Details for the file python_vagrant_metadata-0.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for python_vagrant_metadata-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 67abf8d5b53a6185c111d3dcaa11e39ced6b3d4e57204821652ce96362e878c9
MD5 7dd2836cefb2b6523d1e9f014f48d06a
BLAKE2b-256 c80cf3635d6d2e0a27dfaf787925a36c1911a865f063cf0284caa58cece790fe

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page