# omnivista_py
`omnivista_py` is a Python library that simplifies interaction with the OmniVista API. It allows easy authentication with a username and password, management of network devices, and querying of performance data. With integrated error handling and optional logging, the client provides developers with an effective tool for automating and monitoring network infrastructures.
## Installation
To install the library, use pip:
```sh
pip install omnivista_py
```
## Usage
### Initialization
First, initialize the `OVClient` with the base URL of the API, username, password, and optional parameters for SSL verification and logging.
```python
from omnivista_py import OVClient
client = OVClient(
url="https://omnivista.company.de",
username="your_username",
password="your_password",
verify=True, # Optional, default is True
log=True # Optional, default is False
)
```
### Authentication
Log in to the API:
```python
client.login()
```
### Device Management
#### Get All Devices
Retrieve a list of all devices:
```python
devices = client.get_all_devices()
```
#### Device Information
Create a `Device` instance and retrieve various information:
```python
device = client.Device(client, ip_address="192.168.1.1")
# Get all information
info = device.get_all_information()
# Get specific details
hostname = device.get_hostname()
ip_address = device.get_ip_address()
mac_address = device.get_mac_address()
model_name = device.get_model_name()
running_directory = device.get_running_directory()
location = device.get_location()
description = device.get_description()
software_version = device.get_software_version()
software_version_advanced = device.get_software_version_advanced()
ip_interfaces = device.get_ip_interfaces()
```
## Error Handling
The library includes custom exceptions for error handling:
- `APIClientError`: Base class for exceptions in this module.
- `AuthenticationError`: Raised for authentication-related errors.
- `DeviceRetrievalError`: Raised when retrieving devices fails.
- `LoginError`: Raised when login fails.
Example:
```python
try:
client.login()
except LoginError as e:
print(f"Login failed: {e}")
```
## License
This project is licensed under the MIT License.
Raw data
{
"_id": null,
"home_page": "https://github.com/phillipyosief/omnivista_py",
"name": "omnivista-py-phillipyosief",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": null,
"author": "Phillip Jerome Yosief",
"author_email": "Phillip Jerome Yosief <phillip.yosief@outlook.com>",
"download_url": "https://files.pythonhosted.org/packages/6b/db/b5f75c22a2a5b20c23224f665b232356fb109d0c4ee1a72b5901321923e5/omnivista_py_phillipyosief-0.3.6.tar.gz",
"platform": null,
"description": "# omnivista_py\n\n`omnivista_py` is a Python library that simplifies interaction with the OmniVista API. It allows easy authentication with a username and password, management of network devices, and querying of performance data. With integrated error handling and optional logging, the client provides developers with an effective tool for automating and monitoring network infrastructures.\n\n## Installation\n\nTo install the library, use pip:\n\n```sh\npip install omnivista_py\n```\n\n## Usage\n\n### Initialization\n\nFirst, initialize the `OVClient` with the base URL of the API, username, password, and optional parameters for SSL verification and logging.\n\n```python\nfrom omnivista_py import OVClient\n\nclient = OVClient(\n url=\"https://omnivista.company.de\",\n username=\"your_username\",\n password=\"your_password\",\n verify=True, # Optional, default is True\n log=True # Optional, default is False\n)\n```\n\n### Authentication\n\nLog in to the API:\n\n```python\nclient.login()\n```\n\n### Device Management\n\n#### Get All Devices\n\nRetrieve a list of all devices:\n\n```python\ndevices = client.get_all_devices()\n```\n\n#### Device Information\n\nCreate a `Device` instance and retrieve various information:\n\n```python\ndevice = client.Device(client, ip_address=\"192.168.1.1\")\n\n# Get all information\ninfo = device.get_all_information()\n\n# Get specific details\nhostname = device.get_hostname()\nip_address = device.get_ip_address()\nmac_address = device.get_mac_address()\nmodel_name = device.get_model_name()\nrunning_directory = device.get_running_directory()\nlocation = device.get_location()\ndescription = device.get_description()\nsoftware_version = device.get_software_version()\nsoftware_version_advanced = device.get_software_version_advanced()\nip_interfaces = device.get_ip_interfaces()\n```\n\n## Error Handling\n\nThe library includes custom exceptions for error handling:\n\n- `APIClientError`: Base class for exceptions in this module.\n- `AuthenticationError`: Raised for authentication-related errors.\n- `DeviceRetrievalError`: Raised when retrieving devices fails.\n- `LoginError`: Raised when login fails.\n\nExample:\n\n```python\ntry:\n client.login()\nexcept LoginError as e:\n print(f\"Login failed: {e}\")\n```\n\n## License\n\nThis project is licensed under the MIT License.\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python library that simplifies interaction with the OmniVista API, enabling easy authentication, device management, and performance data querying.",
"version": "0.3.6",
"project_urls": {
"Homepage": "https://github.com/phillipyosief/omnivista_py",
"Issues": "https://github.com/phillipyosief/omnivista_py/issues"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "26742b7a092c6587a5db37839ade6e0f737494fe28970964335ac4f2d4c1e295",
"md5": "735ac0a3c474027481a52bfc7a7f3e2b",
"sha256": "10e09a8b2a18994bb9ff00a03894d0c7f60ddac55e6e595fcd401261561ce467"
},
"downloads": -1,
"filename": "omnivista_py_phillipyosief-0.3.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "735ac0a3c474027481a52bfc7a7f3e2b",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 6352,
"upload_time": "2024-11-02T22:05:32",
"upload_time_iso_8601": "2024-11-02T22:05:32.952264Z",
"url": "https://files.pythonhosted.org/packages/26/74/2b7a092c6587a5db37839ade6e0f737494fe28970964335ac4f2d4c1e295/omnivista_py_phillipyosief-0.3.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6bdbb5f75c22a2a5b20c23224f665b232356fb109d0c4ee1a72b5901321923e5",
"md5": "6de7d8e890bcd6c22359fe747764768b",
"sha256": "87bc5a82513b705401c90150d3a1fe639c51417aa500a845f07a1248f1f46c51"
},
"downloads": -1,
"filename": "omnivista_py_phillipyosief-0.3.6.tar.gz",
"has_sig": false,
"md5_digest": "6de7d8e890bcd6c22359fe747764768b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 5589,
"upload_time": "2024-11-02T22:05:34",
"upload_time_iso_8601": "2024-11-02T22:05:34.603125Z",
"url": "https://files.pythonhosted.org/packages/6b/db/b5f75c22a2a5b20c23224f665b232356fb109d0c4ee1a72b5901321923e5/omnivista_py_phillipyosief-0.3.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-02 22:05:34",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "phillipyosief",
"github_project": "omnivista_py",
"github_fetch_exception": true,
"lcname": "omnivista-py-phillipyosief"
}