diff options
| author | Roberto Bertó <463349+robertoberto@users.noreply.github.com> | 2025-11-02 19:55:55 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-02 19:55:55 -0300 |
| commit | 6ca1269b138696b69c33d2db4bcf7dd03ea4caeb (patch) | |
| tree | 4c0a634730df2123ff506252cbec050de006dac8 /docs/getting-started.md | |
| parent | 1ada32975f0bb559ec7526e0dd545700dde1cb94 (diff) | |
| parent | 6b4e9015744ab8c9f17a6b8e23387cd676b1d827 (diff) | |
| download | pyvyos-6ca1269b138696b69c33d2db4bcf7dd03ea4caeb.tar.gz pyvyos-6ca1269b138696b69c33d2db4bcf7dd03ea4caeb.zip | |
Merge pull request #27 from vyos-contrib/feat/architecture-and-quality-improvements
feat: v0.4.0 - Architecture refactor, bug fixes, and quality improvem…
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 + |
