paulexyz-pynetbox


Namepaulexyz-pynetbox JSON
Version 7.0.0.post1 PyPI version JSON
download
home_page
SummaryNetBox API client library
upload_time2023-01-02 18:16:52
maintainer
docs_urlNone
authorZach Moody
requires_python
licenseApache2
keywords netbox
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pynetbox Fork to fix Issue  #497

> This is a Fork of pynetbox which fixes this [issue](https://github.com/netbox-community/pynetbox/issues/497)
> by applying the fix @endreszabo suggested in [this comment](https://github.com/netbox-community/pynetbox/issues/497#issuecomment-1248987555)

---
Python API client library for [NetBox](https://github.com/netbox-community/netbox).

> **Note:** Version 6.7 and later of the library only supports NetBox 3.3 and above.

## Installation

To install run `pip install pynetbox`.

Alternatively, you can clone the repo and run `python setup.py install`.


## Quick Start

The full pynetbox API is documented on [Read the Docs](http://pynetbox.readthedocs.io/en/latest/), but the following should be enough to get started using it.

To begin, import pynetbox and instantiate the API.

```
import pynetbox
nb = pynetbox.api(
    'http://localhost:8000',
    private_key_file='/path/to/private-key.pem',
    token='d6f4e314a5b5fefd164995169f28ae32d987704f'
)
```

The first argument the .api() method takes is the NetBox URL. There are a handful of named arguments you can provide, but in most cases none are required to simply pull data. In order to write, the `token` argument should to be provided. To decrypt information from the `secrets` endpoint either the `private_key_file` or `private_key` argument needs to be provided.


## Queries

The pynetbox API is setup so that NetBox's apps are attributes of the `.api()` object, and in turn those apps have attribute representing each endpoint. Each endpoint has a handful of methods available to carry out actions on the endpoint. For example, in order to query all the objects in the `devices` endpoint you would do the following:

```
>>> devices = nb.dcim.devices.all()
>>> for device in devices:
...     print(device.name)
...
test1-leaf1
test1-leaf2
test1-leaf3
>>>
```

### Threading

pynetbox supports multithreaded calls for `.filter()` and `.all()` queries. It is **highly recommended** you have `MAX_PAGE_SIZE` in your Netbox install set to anything *except* `0` or `None`. The default value of `1000` is usually a good value to use. To enable threading, add `threading=True` parameter to the `.api`:

```python
nb = pynetbox.api(
    'http://localhost:8000',
    threading=True,
)
```



            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "paulexyz-pynetbox",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "netbox",
    "author": "Zach Moody",
    "author_email": "zmoody@do.co",
    "download_url": "https://files.pythonhosted.org/packages/f0/f7/38c658b77fb2aeef9337e9a61d664d97b7fadc2c1e0c15053f2f5e7e6a35/paulexyz_pynetbox-7.0.0.post1.tar.gz",
    "platform": null,
    "description": "# Pynetbox Fork to fix Issue  #497\n\n> This is a Fork of pynetbox which fixes this [issue](https://github.com/netbox-community/pynetbox/issues/497)\n> by applying the fix @endreszabo suggested in [this comment](https://github.com/netbox-community/pynetbox/issues/497#issuecomment-1248987555)\n\n---\nPython API client library for [NetBox](https://github.com/netbox-community/netbox).\n\n> **Note:** Version 6.7 and later of the library only supports NetBox 3.3 and above.\n\n## Installation\n\nTo install run `pip install pynetbox`.\n\nAlternatively, you can clone the repo and run `python setup.py install`.\n\n\n## Quick Start\n\nThe full pynetbox API is documented on [Read the Docs](http://pynetbox.readthedocs.io/en/latest/), but the following should be enough to get started using it.\n\nTo begin, import pynetbox and instantiate the API.\n\n```\nimport pynetbox\nnb = pynetbox.api(\n    'http://localhost:8000',\n    private_key_file='/path/to/private-key.pem',\n    token='d6f4e314a5b5fefd164995169f28ae32d987704f'\n)\n```\n\nThe first argument the .api() method takes is the NetBox URL. There are a handful of named arguments you can provide, but in most cases none are required to simply pull data. In order to write, the `token` argument should to be provided. To decrypt information from the `secrets` endpoint either the `private_key_file` or `private_key` argument needs to be provided.\n\n\n## Queries\n\nThe pynetbox API is setup so that NetBox's apps are attributes of the `.api()` object, and in turn those apps have attribute representing each endpoint. Each endpoint has a handful of methods available to carry out actions on the endpoint. For example, in order to query all the objects in the `devices` endpoint you would do the following:\n\n```\n>>> devices = nb.dcim.devices.all()\n>>> for device in devices:\n...     print(device.name)\n...\ntest1-leaf1\ntest1-leaf2\ntest1-leaf3\n>>>\n```\n\n### Threading\n\npynetbox supports multithreaded calls for `.filter()` and `.all()` queries. It is **highly recommended** you have `MAX_PAGE_SIZE` in your Netbox install set to anything *except* `0` or `None`. The default value of `1000` is usually a good value to use. To enable threading, add `threading=True` parameter to the `.api`:\n\n```python\nnb = pynetbox.api(\n    'http://localhost:8000',\n    threading=True,\n)\n```\n\n\n",
    "bugtrack_url": null,
    "license": "Apache2",
    "summary": "NetBox API client library",
    "version": "7.0.0.post1",
    "split_keywords": [
        "netbox"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a28904c2f65756df9fe26ecff35d1ccc844d25ef8f89753eae4bac3db29d2767",
                "md5": "d1b64d017c970e8c426a1bd0d46990f2",
                "sha256": "b6dfd96f36cc0e292add53c31cafd6d711af6133f023208214f2d6f64dfdbb46"
            },
            "downloads": -1,
            "filename": "paulexyz_pynetbox-7.0.0.post1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "d1b64d017c970e8c426a1bd0d46990f2",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 33942,
            "upload_time": "2023-01-02T18:16:50",
            "upload_time_iso_8601": "2023-01-02T18:16:50.825204Z",
            "url": "https://files.pythonhosted.org/packages/a2/89/04c2f65756df9fe26ecff35d1ccc844d25ef8f89753eae4bac3db29d2767/paulexyz_pynetbox-7.0.0.post1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f0f738c658b77fb2aeef9337e9a61d664d97b7fadc2c1e0c15053f2f5e7e6a35",
                "md5": "06e44277319b541db40e1017de43f87e",
                "sha256": "6991712dcebb134fe1b44bbbbdc32ed4ce7f95b91a96278e524da90f82817c2f"
            },
            "downloads": -1,
            "filename": "paulexyz_pynetbox-7.0.0.post1.tar.gz",
            "has_sig": false,
            "md5_digest": "06e44277319b541db40e1017de43f87e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 65547,
            "upload_time": "2023-01-02T18:16:52",
            "upload_time_iso_8601": "2023-01-02T18:16:52.373601Z",
            "url": "https://files.pythonhosted.org/packages/f0/f7/38c658b77fb2aeef9337e9a61d664d97b7fadc2c1e0c15053f2f5e7e6a35/paulexyz_pynetbox-7.0.0.post1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-02 18:16:52",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "paulexyz-pynetbox"
}
        
Elapsed time: 0.05240s