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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

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