pykada 0.0.10__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pykada-0.0.10/.gitignore +2 -0
- pykada-0.0.10/.idea/inspectionProfiles/Project_Default.xml +13 -0
- pykada-0.0.10/.idea/inspectionProfiles/profiles_settings.xml +6 -0
- pykada-0.0.10/.idea/modules.xml +8 -0
- pykada-0.0.10/.idea/pykada.iml +8 -0
- pykada-0.0.10/.idea/vcs.xml +6 -0
- pykada-0.0.10/.idea/workspace.xml +44 -0
- pykada-0.0.10/LICENSE +21 -0
- pykada-0.0.10/PKG-INFO +181 -0
- pykada-0.0.10/README.md +160 -0
- pykada-0.0.10/__init.py__ +1 -0
- pykada-0.0.10/pykada/access_control/access_credentials.py +253 -0
- pykada-0.0.10/pykada/access_control/access_door_exceptions.py +353 -0
- pykada-0.0.10/pykada/access_control/access_doors.py +67 -0
- pykada-0.0.10/pykada/access_control/access_events.py +67 -0
- pykada-0.0.10/pykada/access_control/access_groups.py +133 -0
- pykada-0.0.10/pykada/access_control/access_levels.py +250 -0
- pykada-0.0.10/pykada/access_control/access_users.py +279 -0
- pykada-0.0.10/pykada/access_control/test_access_control_credentials.py +198 -0
- pykada-0.0.10/pykada/access_control/test_access_doors.py +97 -0
- pykada-0.0.10/pykada/access_control/test_access_events.py +117 -0
- pykada-0.0.10/pykada/access_control/test_access_groups.py +163 -0
- pykada-0.0.10/pykada/access_control/test_access_levels.py +206 -0
- pykada-0.0.10/pykada/access_control/test_access_users.py +267 -0
- pykada-0.0.10/pykada/access_control/test_door_exceptions.py +506 -0
- pykada-0.0.10/pykada/access_control/testbed/Cary-Grant.png +0 -0
- pykada-0.0.10/pykada/access_control/testbed/testbed.py +429 -0
- pykada-0.0.10/pykada/alarms/classic_alarms.py +48 -0
- pykada-0.0.10/pykada/alarms/test_classic_alarms.py +65 -0
- pykada-0.0.10/pykada/alarms/testbed/testbed.py +17 -0
- pykada-0.0.10/pykada/api_tokens.py +157 -0
- pykada-0.0.10/pykada/cameras/camera_stream.py +53 -0
- pykada-0.0.10/pykada/cameras/cameras.py +721 -0
- pykada-0.0.10/pykada/cameras/test_cameras.py +87 -0
- pykada-0.0.10/pykada/cameras/testbed/Cary-Grant.png +0 -0
- pykada-0.0.10/pykada/cameras/testbed/licenseplates.csv +3 -0
- pykada-0.0.10/pykada/cameras/testbed/testbed.py +408 -0
- pykada-0.0.10/pykada/core_command/core_command.py +223 -0
- pykada-0.0.10/pykada/core_command/test_core_command.py +77 -0
- pykada-0.0.10/pykada/core_command/testbed/testbed.py +70 -0
- pykada-0.0.10/pykada/endpoints.py +146 -0
- pykada-0.0.10/pykada/helix/helix.py +334 -0
- pykada-0.0.10/pykada/helix/test_helix.py +118 -0
- pykada-0.0.10/pykada/helix/testbed/testbed.py +98 -0
- pykada-0.0.10/pykada/helpers.py +422 -0
- pykada-0.0.10/pykada/sensors/sensors.py +178 -0
- pykada-0.0.10/pykada/sensors/test_sensor.py +49 -0
- pykada-0.0.10/pykada/sensors/testbed/testbed.py +48 -0
- pykada-0.0.10/pykada/verkada_requests.py +108 -0
- pykada-0.0.10/pykada/viewing_stations/test_viewing_stations.py +10 -0
- pykada-0.0.10/pykada/viewing_stations/testbed/testbed.py +12 -0
- pykada-0.0.10/pykada/viewing_stations/viewing_stations.py +13 -0
- pykada-0.0.10/pykada/workplace/deny_list_example.csv +4 -0
- pykada-0.0.10/pykada/workplace/test_workplace.py +69 -0
- pykada-0.0.10/pykada/workplace/testbed/testbed.py +47 -0
- pykada-0.0.10/pykada/workplace/workplace.py +142 -0
- pykada-0.0.10/pyproject.toml +45 -0
- pykada-0.0.10/requirements.txt +9 -0
pykada-0.0.10/.gitignore
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<component name="InspectionProjectProfileManager">
|
|
2
|
+
<profile version="1.0">
|
|
3
|
+
<option name="myName" value="Project Default" />
|
|
4
|
+
<inspection_tool class="PyMissingOrEmptyDocstringInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
|
|
5
|
+
<inspection_tool class="PyPep8NamingInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
|
|
6
|
+
<option name="ignoredErrors">
|
|
7
|
+
<list>
|
|
8
|
+
<option value="N806" />
|
|
9
|
+
</list>
|
|
10
|
+
</option>
|
|
11
|
+
</inspection_tool>
|
|
12
|
+
</profile>
|
|
13
|
+
</component>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module type="PYTHON_MODULE" version="4">
|
|
3
|
+
<component name="NewModuleRootManager">
|
|
4
|
+
<content url="file://$MODULE_DIR$" />
|
|
5
|
+
<orderEntry type="inheritedJdk" />
|
|
6
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
7
|
+
</component>
|
|
8
|
+
</module>
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ChangeListManager">
|
|
4
|
+
<list default="true" id="ca47c520-58fd-48ae-9dad-6c38aaead4d9" name="Changes" comment="" />
|
|
5
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
6
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
7
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
8
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
9
|
+
</component>
|
|
10
|
+
<component name="Git.Settings">
|
|
11
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
|
|
12
|
+
</component>
|
|
13
|
+
<component name="ProjectColorInfo"><![CDATA[{
|
|
14
|
+
"associatedIndex": 6
|
|
15
|
+
}]]></component>
|
|
16
|
+
<component name="ProjectId" id="30COUriJjZiWE6Wt4yvZoKUdGTE" />
|
|
17
|
+
<component name="ProjectViewState">
|
|
18
|
+
<option name="hideEmptyMiddlePackages" value="true" />
|
|
19
|
+
<option name="showLibraryContents" value="true" />
|
|
20
|
+
</component>
|
|
21
|
+
<component name="PropertiesComponent"><![CDATA[{
|
|
22
|
+
"keyToString": {
|
|
23
|
+
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
24
|
+
"git-widget-placeholder": "master"
|
|
25
|
+
}
|
|
26
|
+
}]]></component>
|
|
27
|
+
<component name="SharedIndexes">
|
|
28
|
+
<attachedChunks>
|
|
29
|
+
<set>
|
|
30
|
+
<option value="bundled-python-sdk-4c141bd692a7-e2d783800521-com.jetbrains.pycharm.community.sharedIndexes.bundled-PC-251.26927.90" />
|
|
31
|
+
</set>
|
|
32
|
+
</attachedChunks>
|
|
33
|
+
</component>
|
|
34
|
+
<component name="TaskManager">
|
|
35
|
+
<task active="true" id="Default" summary="Default task">
|
|
36
|
+
<changelist id="ca47c520-58fd-48ae-9dad-6c38aaead4d9" name="Changes" comment="" />
|
|
37
|
+
<created>1753128106858</created>
|
|
38
|
+
<option name="number" value="Default" />
|
|
39
|
+
<option name="presentableId" value="Default" />
|
|
40
|
+
<updated>1753128106858</updated>
|
|
41
|
+
</task>
|
|
42
|
+
<servers />
|
|
43
|
+
</component>
|
|
44
|
+
</project>
|
pykada-0.0.10/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Ryan Malley
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
pykada-0.0.10/PKG-INFO
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pykada
|
|
3
|
+
Version: 0.0.10
|
|
4
|
+
Summary: A handy library for interacting with Verkada APIs.
|
|
5
|
+
Project-URL: Homepage, https://github.com/ryanmalley101/pykada
|
|
6
|
+
Project-URL: Issues, https://github.com/ryanmalley101/pykada/issues
|
|
7
|
+
Author-email: Ryan Malley <ryanmalley101@gmail.com>
|
|
8
|
+
Classifier: Operating System :: OS Independent
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Requires-Python: >=3.10
|
|
11
|
+
Requires-Dist: numpy~=2.2.6
|
|
12
|
+
Requires-Dist: pandas~=2.2.3
|
|
13
|
+
Requires-Dist: pytest~=8.3.5
|
|
14
|
+
Requires-Dist: python-dotenv~=1.1.0
|
|
15
|
+
Requires-Dist: python-vlc~=3.0.21203
|
|
16
|
+
Requires-Dist: requests~=2.32.3
|
|
17
|
+
Requires-Dist: termcolor~=3.1.0
|
|
18
|
+
Requires-Dist: typeguard~=4.4.2
|
|
19
|
+
Requires-Dist: urllib3~=2.4.0
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
|
|
22
|
+
# Pykada: A Python Client for the Verkada API
|
|
23
|
+
## Introduction to Pykada
|
|
24
|
+
Navigating the Verkada Public API directly can present certain complexities. Pykada was developed to serve as a dedicated Python library aimed at simplifying these interactions. The core objective is to provide developers with a Pythonic and intuitive interface, abstracting the lower-level details of direct API calls. This library is designed to enhance developer efficiency when integrating Verkada's physical security solutions into custom applications and workflows.
|
|
25
|
+
|
|
26
|
+
## About Verkada
|
|
27
|
+
Verkada is recognized as a leader in cloud-based physical security. Their mission is centered on protecting people and places while prioritizing privacy. They achieve this through a unified system accessible via their cloud platform, Verkada Command.
|
|
28
|
+
|
|
29
|
+
Verkada offers a comprehensive suite of integrated product lines:
|
|
30
|
+
|
|
31
|
+
* Video Security
|
|
32
|
+
* Access Control
|
|
33
|
+
* Environmental sensors
|
|
34
|
+
* Alarms
|
|
35
|
+
* Workplace (Guest and Mailroom)
|
|
36
|
+
* Intercoms
|
|
37
|
+
* Gateways (Cell and WiFi)
|
|
38
|
+
|
|
39
|
+
Pykada is designed to interface with the APIs governing these systems, enabling programmatic access and management of data within the Verkada ecosystem.
|
|
40
|
+
|
|
41
|
+
## Important Disclaimer:
|
|
42
|
+
|
|
43
|
+
Please be aware that Pykada is not an official Verkada product. It is not affiliated with, endorsed by, or supported by Verkada Inc. This library is maintained independently.
|
|
44
|
+
|
|
45
|
+
For the most accurate and current information regarding the Verkada API, developers should always refer to the official Verkada API documentation at apidocs.verkada.com. Any support requests or issues related to the Verkada platform itself should be directed to Verkada Support.
|
|
46
|
+
|
|
47
|
+
## Key Features of Pykada
|
|
48
|
+
Pykada offers several features designed to streamline the use of the Verkada API:
|
|
49
|
+
|
|
50
|
+
**Simplified Authentication:** Manages the intricacies of API token generation and management, including the automatic refreshing of short-lived tokens.
|
|
51
|
+
|
|
52
|
+
**Object-Oriented Interface:** Provides Python objects representing Verkada entities (e.g., Cameras, Doors, Alerts), offering a more intuitive approach compared to handling raw JSON responses.
|
|
53
|
+
**Camera Management Capabilities:** Retrieve lists and detailed information for Verkada cameras.
|
|
54
|
+
|
|
55
|
+
**Alert Analytics:** Access camera alerts, including motion, crowd, person of interest, online/offline status, and tamper events.
|
|
56
|
+
|
|
57
|
+
**Ingest Analytics** Fetch camera analytics such as occupancy trends and License Plate Recognition (LPR) data.
|
|
58
|
+
|
|
59
|
+
**Access Control Integration:** List Verkada access control doors and retrieve their details.
|
|
60
|
+
|
|
61
|
+
**Control Doors**Programmatically unlock doors (requires specific configuration within Verkada Command).
|
|
62
|
+
|
|
63
|
+
**Clear Error Handling:** Translates API error responses into descriptive Python exceptions for easier debugging.
|
|
64
|
+
|
|
65
|
+
The primary value of Pykada lies in the abstraction and ease of use it provides. For example, the automatic handling of short-lived API token refreshing allows developers to concentrate on application logic rather than authentication management.
|
|
66
|
+
|
|
67
|
+
## Requirements
|
|
68
|
+
Python Version: Python 3.8 or higher is required.
|
|
69
|
+
|
|
70
|
+
External Dependencies: Pykada relies on libraries such as requests for making HTTP API calls. These dependencies are typically installed automatically when Pykada is installed via pip.
|
|
71
|
+
|
|
72
|
+
**Verkada Account & API Access:**
|
|
73
|
+
|
|
74
|
+
A valid Verkada organization account is mandatory.
|
|
75
|
+
|
|
76
|
+
API access must be enabled for the organization within Verkada Command.
|
|
77
|
+
|
|
78
|
+
An API Key must be generated from the Verkada Command platform; this key serves as the primary credential for API interaction.
|
|
79
|
+
|
|
80
|
+
That API key must be placed in a `.env` file in the root directory of the project. The file should contain a line in the format:
|
|
81
|
+
|
|
82
|
+
```
|
|
83
|
+
VERKADA_API_KEY="YOUR_API_KEY_HERE"
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Example Usage
|
|
87
|
+
This guide demonstrates how to use the library directly to perform some basic API calls without running the testbeds. These examples cover common operations such as retrieving data, creating resources, and updating configurations.
|
|
88
|
+
|
|
89
|
+
Prerequisites
|
|
90
|
+
Ensure your `.env` file has a valid API key "VERKADA_API_KEY". The library uses the `python-dotenv` package to load these variables.
|
|
91
|
+
|
|
92
|
+
### Example 1: Retrieve All Cameras
|
|
93
|
+
Retrieve a list of all cameras in the system
|
|
94
|
+
|
|
95
|
+
```
|
|
96
|
+
from cameras.cameras import get_all_cameras
|
|
97
|
+
|
|
98
|
+
# Fetch all cameras
|
|
99
|
+
cameras = get_all_cameras()
|
|
100
|
+
print("Cameras:", cameras)
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Example 2: Create and Delete a POI (Person of Interest)
|
|
104
|
+
Create a new POI and then delete it.
|
|
105
|
+
|
|
106
|
+
```
|
|
107
|
+
from cameras.cameras import create_poi, delete_poi
|
|
108
|
+
|
|
109
|
+
# Create a new POI
|
|
110
|
+
poi = create_poi(image_url="example.png", label="Test POI")
|
|
111
|
+
print("Created POI:", poi)
|
|
112
|
+
|
|
113
|
+
# Delete the POI
|
|
114
|
+
delete_response = delete_poi(person_id=poi["person_id"])
|
|
115
|
+
print("Deleted POI:", delete_response)
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Example 3: Retrieve Sensor Data
|
|
119
|
+
Retrieve temperature and humidity data for a specific sensor.
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
import os
|
|
123
|
+
from sensors.sensors import get_all_sensor_data
|
|
124
|
+
from helpers import SENSOR_FIELD_ENUM
|
|
125
|
+
import time
|
|
126
|
+
|
|
127
|
+
sensor_id = "YOUR_SENSOR_ID_HERE"
|
|
128
|
+
current_time = int(time.time())
|
|
129
|
+
|
|
130
|
+
# Fetch sensor data
|
|
131
|
+
sensor_data = get_all_sensor_data(
|
|
132
|
+
device_id=sensor_id,
|
|
133
|
+
start_time=current_time - 3600,
|
|
134
|
+
end_time=current_time,
|
|
135
|
+
fields=[SENSOR_FIELD_ENUM["TEMPERATURE"], SENSOR_FIELD_ENUM["HUMIDITY"]],
|
|
136
|
+
interval="5m"
|
|
137
|
+
)
|
|
138
|
+
print("Sensor Data:", sensor_data)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Example 4: Get Camera Alerts
|
|
142
|
+
Retrieve all alerts for a specific camera within a time range.
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
from cameras.cameras import get_all_camera_alerts
|
|
146
|
+
import time
|
|
147
|
+
|
|
148
|
+
current_time = int(time.time())
|
|
149
|
+
|
|
150
|
+
# Fetch camera alerts
|
|
151
|
+
alerts = get_all_camera_alerts(
|
|
152
|
+
start_time=current_time - 3600,
|
|
153
|
+
end_time=current_time,
|
|
154
|
+
include_image_url=True
|
|
155
|
+
)
|
|
156
|
+
print("Camera Alerts:", alerts)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Example 5: Update Cloud Backup Settings
|
|
160
|
+
Update and restore cloud backup settings for a camera.
|
|
161
|
+
```
|
|
162
|
+
from cameras.cameras import get_cloud_backup_settings, update_cloud_backup_settings
|
|
163
|
+
import os
|
|
164
|
+
|
|
165
|
+
camera_id = "YOUR_CAMERA_ID_HERE"
|
|
166
|
+
|
|
167
|
+
# Get current settings
|
|
168
|
+
current_settings = get_cloud_backup_settings(camera_id=camera_id)
|
|
169
|
+
print("Current Settings:", current_settings)
|
|
170
|
+
|
|
171
|
+
# Update settings
|
|
172
|
+
new_settings = current_settings.copy()
|
|
173
|
+
new_settings["enabled"] = not current_settings["enabled"] # Toggle enabled state
|
|
174
|
+
update_response = update_cloud_backup_settings(**new_settings)
|
|
175
|
+
print("Updated Settings:", update_response)
|
|
176
|
+
|
|
177
|
+
# Restore original settings
|
|
178
|
+
restore_response = update_cloud_backup_settings(**current_settings)
|
|
179
|
+
print("Restored Settings:", restore_response)
|
|
180
|
+
```
|
|
181
|
+
|
pykada-0.0.10/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# Pykada: A Python Client for the Verkada API
|
|
2
|
+
## Introduction to Pykada
|
|
3
|
+
Navigating the Verkada Public API directly can present certain complexities. Pykada was developed to serve as a dedicated Python library aimed at simplifying these interactions. The core objective is to provide developers with a Pythonic and intuitive interface, abstracting the lower-level details of direct API calls. This library is designed to enhance developer efficiency when integrating Verkada's physical security solutions into custom applications and workflows.
|
|
4
|
+
|
|
5
|
+
## About Verkada
|
|
6
|
+
Verkada is recognized as a leader in cloud-based physical security. Their mission is centered on protecting people and places while prioritizing privacy. They achieve this through a unified system accessible via their cloud platform, Verkada Command.
|
|
7
|
+
|
|
8
|
+
Verkada offers a comprehensive suite of integrated product lines:
|
|
9
|
+
|
|
10
|
+
* Video Security
|
|
11
|
+
* Access Control
|
|
12
|
+
* Environmental sensors
|
|
13
|
+
* Alarms
|
|
14
|
+
* Workplace (Guest and Mailroom)
|
|
15
|
+
* Intercoms
|
|
16
|
+
* Gateways (Cell and WiFi)
|
|
17
|
+
|
|
18
|
+
Pykada is designed to interface with the APIs governing these systems, enabling programmatic access and management of data within the Verkada ecosystem.
|
|
19
|
+
|
|
20
|
+
## Important Disclaimer:
|
|
21
|
+
|
|
22
|
+
Please be aware that Pykada is not an official Verkada product. It is not affiliated with, endorsed by, or supported by Verkada Inc. This library is maintained independently.
|
|
23
|
+
|
|
24
|
+
For the most accurate and current information regarding the Verkada API, developers should always refer to the official Verkada API documentation at apidocs.verkada.com. Any support requests or issues related to the Verkada platform itself should be directed to Verkada Support.
|
|
25
|
+
|
|
26
|
+
## Key Features of Pykada
|
|
27
|
+
Pykada offers several features designed to streamline the use of the Verkada API:
|
|
28
|
+
|
|
29
|
+
**Simplified Authentication:** Manages the intricacies of API token generation and management, including the automatic refreshing of short-lived tokens.
|
|
30
|
+
|
|
31
|
+
**Object-Oriented Interface:** Provides Python objects representing Verkada entities (e.g., Cameras, Doors, Alerts), offering a more intuitive approach compared to handling raw JSON responses.
|
|
32
|
+
**Camera Management Capabilities:** Retrieve lists and detailed information for Verkada cameras.
|
|
33
|
+
|
|
34
|
+
**Alert Analytics:** Access camera alerts, including motion, crowd, person of interest, online/offline status, and tamper events.
|
|
35
|
+
|
|
36
|
+
**Ingest Analytics** Fetch camera analytics such as occupancy trends and License Plate Recognition (LPR) data.
|
|
37
|
+
|
|
38
|
+
**Access Control Integration:** List Verkada access control doors and retrieve their details.
|
|
39
|
+
|
|
40
|
+
**Control Doors**Programmatically unlock doors (requires specific configuration within Verkada Command).
|
|
41
|
+
|
|
42
|
+
**Clear Error Handling:** Translates API error responses into descriptive Python exceptions for easier debugging.
|
|
43
|
+
|
|
44
|
+
The primary value of Pykada lies in the abstraction and ease of use it provides. For example, the automatic handling of short-lived API token refreshing allows developers to concentrate on application logic rather than authentication management.
|
|
45
|
+
|
|
46
|
+
## Requirements
|
|
47
|
+
Python Version: Python 3.8 or higher is required.
|
|
48
|
+
|
|
49
|
+
External Dependencies: Pykada relies on libraries such as requests for making HTTP API calls. These dependencies are typically installed automatically when Pykada is installed via pip.
|
|
50
|
+
|
|
51
|
+
**Verkada Account & API Access:**
|
|
52
|
+
|
|
53
|
+
A valid Verkada organization account is mandatory.
|
|
54
|
+
|
|
55
|
+
API access must be enabled for the organization within Verkada Command.
|
|
56
|
+
|
|
57
|
+
An API Key must be generated from the Verkada Command platform; this key serves as the primary credential for API interaction.
|
|
58
|
+
|
|
59
|
+
That API key must be placed in a `.env` file in the root directory of the project. The file should contain a line in the format:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
VERKADA_API_KEY="YOUR_API_KEY_HERE"
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Example Usage
|
|
66
|
+
This guide demonstrates how to use the library directly to perform some basic API calls without running the testbeds. These examples cover common operations such as retrieving data, creating resources, and updating configurations.
|
|
67
|
+
|
|
68
|
+
Prerequisites
|
|
69
|
+
Ensure your `.env` file has a valid API key "VERKADA_API_KEY". The library uses the `python-dotenv` package to load these variables.
|
|
70
|
+
|
|
71
|
+
### Example 1: Retrieve All Cameras
|
|
72
|
+
Retrieve a list of all cameras in the system
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
from cameras.cameras import get_all_cameras
|
|
76
|
+
|
|
77
|
+
# Fetch all cameras
|
|
78
|
+
cameras = get_all_cameras()
|
|
79
|
+
print("Cameras:", cameras)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Example 2: Create and Delete a POI (Person of Interest)
|
|
83
|
+
Create a new POI and then delete it.
|
|
84
|
+
|
|
85
|
+
```
|
|
86
|
+
from cameras.cameras import create_poi, delete_poi
|
|
87
|
+
|
|
88
|
+
# Create a new POI
|
|
89
|
+
poi = create_poi(image_url="example.png", label="Test POI")
|
|
90
|
+
print("Created POI:", poi)
|
|
91
|
+
|
|
92
|
+
# Delete the POI
|
|
93
|
+
delete_response = delete_poi(person_id=poi["person_id"])
|
|
94
|
+
print("Deleted POI:", delete_response)
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Example 3: Retrieve Sensor Data
|
|
98
|
+
Retrieve temperature and humidity data for a specific sensor.
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
import os
|
|
102
|
+
from sensors.sensors import get_all_sensor_data
|
|
103
|
+
from helpers import SENSOR_FIELD_ENUM
|
|
104
|
+
import time
|
|
105
|
+
|
|
106
|
+
sensor_id = "YOUR_SENSOR_ID_HERE"
|
|
107
|
+
current_time = int(time.time())
|
|
108
|
+
|
|
109
|
+
# Fetch sensor data
|
|
110
|
+
sensor_data = get_all_sensor_data(
|
|
111
|
+
device_id=sensor_id,
|
|
112
|
+
start_time=current_time - 3600,
|
|
113
|
+
end_time=current_time,
|
|
114
|
+
fields=[SENSOR_FIELD_ENUM["TEMPERATURE"], SENSOR_FIELD_ENUM["HUMIDITY"]],
|
|
115
|
+
interval="5m"
|
|
116
|
+
)
|
|
117
|
+
print("Sensor Data:", sensor_data)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Example 4: Get Camera Alerts
|
|
121
|
+
Retrieve all alerts for a specific camera within a time range.
|
|
122
|
+
|
|
123
|
+
```
|
|
124
|
+
from cameras.cameras import get_all_camera_alerts
|
|
125
|
+
import time
|
|
126
|
+
|
|
127
|
+
current_time = int(time.time())
|
|
128
|
+
|
|
129
|
+
# Fetch camera alerts
|
|
130
|
+
alerts = get_all_camera_alerts(
|
|
131
|
+
start_time=current_time - 3600,
|
|
132
|
+
end_time=current_time,
|
|
133
|
+
include_image_url=True
|
|
134
|
+
)
|
|
135
|
+
print("Camera Alerts:", alerts)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### Example 5: Update Cloud Backup Settings
|
|
139
|
+
Update and restore cloud backup settings for a camera.
|
|
140
|
+
```
|
|
141
|
+
from cameras.cameras import get_cloud_backup_settings, update_cloud_backup_settings
|
|
142
|
+
import os
|
|
143
|
+
|
|
144
|
+
camera_id = "YOUR_CAMERA_ID_HERE"
|
|
145
|
+
|
|
146
|
+
# Get current settings
|
|
147
|
+
current_settings = get_cloud_backup_settings(camera_id=camera_id)
|
|
148
|
+
print("Current Settings:", current_settings)
|
|
149
|
+
|
|
150
|
+
# Update settings
|
|
151
|
+
new_settings = current_settings.copy()
|
|
152
|
+
new_settings["enabled"] = not current_settings["enabled"] # Toggle enabled state
|
|
153
|
+
update_response = update_cloud_backup_settings(**new_settings)
|
|
154
|
+
print("Updated Settings:", update_response)
|
|
155
|
+
|
|
156
|
+
# Restore original settings
|
|
157
|
+
restore_response = update_cloud_backup_settings(**current_settings)
|
|
158
|
+
print("Restored Settings:", restore_response)
|
|
159
|
+
```
|
|
160
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|