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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

python_vagrant_metadata-0.0.2-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python_vagrant_metadata-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/18.0.1 rfc3986/2.0.0 colorama/0.4.3 CPython/3.8.10

File hashes

Hashes for python_vagrant_metadata-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 99a7e4bbbd8e198a8681ab1994615d3d328f74eda4b0b828ebcaec45bd91b644
MD5 f4e7e7426461e9da593ea34329f769d2
BLAKE2b-256 b5b0bbcad8740244b5e393200623715ce1487900eb0d4e19d0d5473be89767c0

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