diff options
| author | roberto berto <rberto@deepcausa.com> | 2025-11-02 22:54:44 +0000 |
|---|---|---|
| committer | roberto berto <rberto@deepcausa.com> | 2025-11-02 22:54:44 +0000 |
| commit | 6b4e9015744ab8c9f17a6b8e23387cd676b1d827 (patch) | |
| tree | 4c0a634730df2123ff506252cbec050de006dac8 /docs/getting-started.md | |
| parent | 1ada32975f0bb559ec7526e0dd545700dde1cb94 (diff) | |
| download | pyvyos-feat/architecture-and-quality-improvements.tar.gz pyvyos-feat/architecture-and-quality-improvements.zip | |
feat: v0.4.0 - Architecture refactor, bug fixes, and quality improvementsfeat/architecture-and-quality-improvements
- Fixed #25: config_file_save/load now include path: [] in payload
- Added exception hierarchy (SDKError, HttpError, ApiError, ValidationError)
- Added utility functions (json, ids, paths)
- Added structured logging with request ID tracking
- Added optional Pydantic validation models
- Refactored to pyvyos.core.* structure with backward compatibility shims
- Moved JSON specs to docs/development/vyos_api/
- Added comprehensive test suite (19 shim tests, 16 utils tests, 6 exception tests)
- Updated pyproject.toml for uv sync editable installation
- Added development documentation (architecture, roadmap, quality guidelines)
Maintains 100% backward compatibility with 0.3.0
Diffstat (limited to 'docs/getting-started.md')
| -rw-r--r-- | docs/getting-started.md | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/docs/getting-started.md b/docs/getting-started.md new file mode 100644 index 0000000..183c109 --- /dev/null +++ b/docs/getting-started.md @@ -0,0 +1,77 @@ +# Getting Started + +This guide will help you set up PyVyOS and make your first API call to a VyOS device. + +## Prerequisites + +- VyOS device with REST API enabled +- API key generated on your VyOS device +- Network access to your VyOS device + +## Step 1: Install PyVyOS + +See [Installation](installation.md) for detailed instructions. + +## Step 2: Configure Environment Variables + +Create a `.env` file in your project directory: + +```bash +VYDEVICE_HOSTNAME=192.168.1.1 +VYDEVICE_APIKEY=your-api-key-here +VYDEVICE_PORT=443 +VYDEVICE_PROTOCOL=https +VYDEVICE_VERIFY_SSL=False +``` + +## Step 3: Create Your First Script + +```python +import os +from dotenv import load_dotenv +from pyvyos import VyDevice + +load_dotenv() + +device = VyDevice( + hostname=os.getenv('VYDEVICE_HOSTNAME'), + apikey=os.getenv('VYDEVICE_APIKEY'), + port=os.getenv('VYDEVICE_PORT'), + protocol=os.getenv('VYDEVICE_PROTOCOL'), + verify=os.getenv('VYDEVICE_VERIFY_SSL', 'True').lower() == 'true' +) + +response = device.show(path=["system", "image"]) +if not response.error: + print(response.result) +else: + print(f"Error: {response.error}") +``` + +## Step 4: Disable SSL Warnings (Optional) + +If using `verify=False`, disable urllib3 warnings: + +```python +import urllib3 +urllib3.disable_warnings() +``` + +## Understanding API Responses + +All methods return an `ApiResponse` object with: +- `status`: HTTP status code +- `request`: Request payload (API key sanitized) +- `result`: Response data dictionary +- `error`: Error message (False if successful) + +## Common Operations + +See [Examples](examples.md) for more detailed usage patterns. + +## Next Steps + +- Read [API Reference](api-reference.md) for complete method documentation +- Explore [Configuration](configuration.md) for advanced setup +- Check [Concepts](concepts.md) to understand PyVyOS architecture + |
