python-vagrant-metadata


Namepython-vagrant-metadata JSON
Version 0.0.5 PyPI version JSON
download
home_pagehttps://github.com/LeConTesteur/python-vagrant-metadata
SummaryCan use and parse metadata information of vagrant box
upload_time2023-09-21 18:37:01
maintainer
docs_urlNone
authorLeConTesteur
requires_python>=3.6
license
keywords vagrant
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # python-vagrant-metadata

python-vagrant-metadata is a library for download vagrant box in vagrant cloud or customs site.

```python
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
```python
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
```python
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
```python
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
```python
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

```python
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
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/LeConTesteur/python-vagrant-metadata",
    "name": "python-vagrant-metadata",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "vagrant",
    "author": "LeConTesteur",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/47/c9/23c16e69ea67c5efe423da79deb12b33a115054cf4d372c1e90f4dd59f4c/python-vagrant-metadata-0.0.5.tar.gz",
    "platform": null,
    "description": "# python-vagrant-metadata\n\npython-vagrant-metadata is a library for download vagrant box in vagrant cloud or customs site.\n\n```python\nimport requests\nfrom vagrant_metadata import fetch, forge_metadata_url\n\nmetadata = fetch(forge_metadata_url('ubuntu/trusty64'))\nurl = metadata.url_for_youngest_version('virtualbox')\n\nresponse = requests.get(url)\nif response.ok:\n  with open('mybox.box', 'wb') as f:\n    f.write(response.content)\n```\n\nIf you need the checksum of box for specific versions, you can use provider as like\n```python\nimport requests\nfrom vagrant_metadata import fetch, forge_metadata_url\n\nmetadata = fetch(forge_metadata_url('ubuntu/trusty64'))\nurl = metadata.url_for('20190514.0.0','virtualbox')\n\nresponse = requests.get(url)\nif response.ok:\n  with open('mybox.box', 'wb') as f:\n    f.write(response.content)\n```\n\n\nIf you need the checksum of box, you can use provider as like\n```python\nfrom vagrant_metadata import fetch, forge_metadata_url\n\nmetadata = fetch(forge_metadata_url('ubuntu/trusty64'))\nprovider = metadata.youngest()['virtualbox']\nprint(provider.url)\nprint(provider.checksum)\n```\n\nIf you need the checksum of box for specific versions, you can use provider as like\n```python\nfrom vagrant_metadata import fetch, forge_metadata_url\n\nmetadata = fetch(forge_metadata_url('ubuntu/trusty64'))\nprovider = metadata['20190514.0.0']['virtualbox']\nprint(provider.url)\nprint(provider.checksum)\n```\n\nIf you want only version with the specific provider, you can filtering as like\n```python\nfrom vagrant_metadata import fetch, forge_metadata_url\n\nmetadata = fetch(forge_metadata_url('ubuntu/trusty64'))\nprovider = metadata.keep_only_provider('virtualbox').youngest()['virtualbox']\nprint(provider.url)\nprint(provider.checksum)\n```\n\n# Build package\n\n```python\npython3 setup.py bdist_wheel\npython3 -m twine upload --skip-existing --repository testpypi dist/*\npython3 -m pip install --index-url https://test.pypi.org/simple/ python-vagrant-metadata\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Can use and parse metadata information of vagrant box",
    "version": "0.0.5",
    "project_urls": {
        "Bug Tracker": "https://github.com/LeConTesteur/python-vagrant-metadata/issues",
        "Homepage": "https://github.com/LeConTesteur/python-vagrant-metadata"
    },
    "split_keywords": [
        "vagrant"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c80cf3635d6d2e0a27dfaf787925a36c1911a865f063cf0284caa58cece790fe",
                "md5": "7dd2836cefb2b6523d1e9f014f48d06a",
                "sha256": "67abf8d5b53a6185c111d3dcaa11e39ced6b3d4e57204821652ce96362e878c9"
            },
            "downloads": -1,
            "filename": "python_vagrant_metadata-0.0.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7dd2836cefb2b6523d1e9f014f48d06a",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 17310,
            "upload_time": "2023-09-21T18:36:59",
            "upload_time_iso_8601": "2023-09-21T18:36:59.495130Z",
            "url": "https://files.pythonhosted.org/packages/c8/0c/f3635d6d2e0a27dfaf787925a36c1911a865f063cf0284caa58cece790fe/python_vagrant_metadata-0.0.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "47c923c16e69ea67c5efe423da79deb12b33a115054cf4d372c1e90f4dd59f4c",
                "md5": "6a41885c8eea5d0b4c29d0dbdb260792",
                "sha256": "98c4355ce7f026c5d9ddd9aa58b249b2e83ab41d2d96a85bc7be7314569426b2"
            },
            "downloads": -1,
            "filename": "python-vagrant-metadata-0.0.5.tar.gz",
            "has_sig": false,
            "md5_digest": "6a41885c8eea5d0b4c29d0dbdb260792",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 17589,
            "upload_time": "2023-09-21T18:37:01",
            "upload_time_iso_8601": "2023-09-21T18:37:01.231470Z",
            "url": "https://files.pythonhosted.org/packages/47/c9/23c16e69ea67c5efe423da79deb12b33a115054cf4d372c1e90f4dd59f4c/python-vagrant-metadata-0.0.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-21 18:37:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "LeConTesteur",
    "github_project": "python-vagrant-metadata",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "tox": true,
    "lcname": "python-vagrant-metadata"
}
        
Elapsed time: 0.11559s