You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> You can view the complete documentation automatically generated by DeepWiki via the [onvif-python AI Wiki](https://deepwiki.com/nirsimetri/onvif-python) link. We currently do not have an official documentation site. Help us create more examples and helpful documentation by [contributing](https://github.com/nirsimetri/onvif-python?tab=contributing-ov-file).
56
56
57
-
Below are simple examples to help you get started with the ONVIF Python library. These demonstrate how to connect to an ONVIF-compliant device and retrieve basic device information.
57
+
Below are simple examples to help you get started with the ONVIF Python library. These demonstrate how to discover and connect to ONVIF-compliant devices and retrieve basic device information.
58
58
59
-
**1. Initialize the ONVIFClient**
59
+
**1. Discover ONVIF Devices (Optional)**
60
+
61
+
Use `ONVIFDiscovery` (applied at [`>=v0.1.6`](https://github.com/nirsimetri/onvif-python/releases/tag/v0.1.6)) to automatically find ONVIF devices on your local network:
62
+
63
+
```python
64
+
from onvif import ONVIFDiscovery
65
+
66
+
# Create discovery instance
67
+
discovery = ONVIFDiscovery(timeout=5)
68
+
69
+
# Discover devices
70
+
devices = discovery.discover()
71
+
72
+
# Display discovered devices
73
+
for device in devices:
74
+
print(f"Found device at {device['host']}:{device['port']}")
75
+
print(f" Scopes: {device.get('scopes', [])}")
76
+
print(f" XAddrs: {device['xaddrs']}")
77
+
```
78
+
79
+
**2. Initialize the ONVIFClient**
60
80
61
81
Create an instance of `ONVIFClient` by providing your device's IP address, port, username, and password:
62
82
@@ -73,7 +93,7 @@ client = ONVIFClient(
73
93
)
74
94
```
75
95
76
-
**2. Create Service Instance**
96
+
**3. Create Service Instance**
77
97
78
98
`ONVIFClient` provides several main services that can be accessed via the following methods:
Berikut adalah contoh sederhana untuk membantu Anda memulai dengan pustaka ONVIF Python. Contoh ini menunjukkan cara menghubungkan ke perangkat yang sesuai dengan ONVIF dan mengambil informasi dasar perangkat.
58
58
59
-
**1. Inisialisasi ONVIFClient**
59
+
**1. Menemukan Perangkat ONVIF (Opsional)**
60
+
61
+
Sebelum menghubungkan ke perangkat tertentu, Anda dapat menemukan perangkat ONVIF di jaringan lokal Anda menggunakan kelas `ONVIFDiscovery` (diterapkan pada [`>=v0.1.6`](https://github.com/nirsimetri/onvif-python/releases/tag/v0.1.6)):
62
+
63
+
```python
64
+
from onvif import ONVIFDiscovery
65
+
66
+
# Buat instance discovery
67
+
discovery = ONVIFDiscovery(timeout=5)
68
+
69
+
# Temukan perangkat
70
+
devices = discovery.discover()
71
+
72
+
# Tampilkan perangkat yang ditemukan
73
+
for device in devices:
74
+
print(f"Ditemukan perangkat di {device['host']}:{device['port']}")
75
+
print(f" Scopes: {device.get('scopes', [])}")
76
+
print(f" XAddrs: {device['xaddrs']}")
77
+
```
78
+
79
+
**2. Inisialisasi ONVIFClient**
60
80
61
81
Buat instance `ONVIFClient` dengan memberikan alamat IP perangkat Anda, port, nama pengguna, dan kata sandi:
62
82
@@ -73,7 +93,7 @@ client = ONVIFClient(
73
93
)
74
94
```
75
95
76
-
**2. Buat Instance Layanan**
96
+
**3. Buat Instance Layanan**
77
97
78
98
`ONVIFClient` menyediakan beberapa layanan utama yang dapat diakses melalui metode berikut:
0 commit comments