id
int64 0
843k
| repository_name
stringlengths 7
55
| file_path
stringlengths 9
332
| class_name
stringlengths 3
290
| human_written_code
stringlengths 12
4.36M
| class_skeleton
stringlengths 19
2.2M
| total_program_units
int64 1
9.57k
| total_doc_str
int64 0
4.2k
| AvgCountLine
float64 0
7.89k
| AvgCountLineBlank
float64 0
300
| AvgCountLineCode
float64 0
7.89k
| AvgCountLineComment
float64 0
7.89k
| AvgCyclomatic
float64 0
130
| CommentToCodeRatio
float64 0
176
| CountClassBase
float64 0
48
| CountClassCoupled
float64 0
589
| CountClassCoupledModified
float64 0
581
| CountClassDerived
float64 0
5.37k
| CountDeclInstanceMethod
float64 0
4.2k
| CountDeclInstanceVariable
float64 0
299
| CountDeclMethod
float64 0
4.2k
| CountDeclMethodAll
float64 0
4.2k
| CountLine
float64 1
115k
| CountLineBlank
float64 0
9.01k
| CountLineCode
float64 0
94.4k
| CountLineCodeDecl
float64 0
46.1k
| CountLineCodeExe
float64 0
91.3k
| CountLineComment
float64 0
27k
| CountStmt
float64 1
93.2k
| CountStmtDecl
float64 0
46.1k
| CountStmtExe
float64 0
90.2k
| MaxCyclomatic
float64 0
759
| MaxInheritanceTree
float64 0
16
| MaxNesting
float64 0
34
| SumCyclomatic
float64 0
6k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
141,348 |
Kane610/axis
|
axis/models/mqtt.py
|
axis.models.mqtt.ClientStatus
|
class ClientStatus:
"""Represent client status."""
connection_status: ClientConnectionState
state: ClientState
active: bool
"""The current state of the client. Possible values are active and inactive."""
connected: bool
"""The current connection state of your client. Possible values are connected, disconnected."""
@classmethod
def from_dict(cls, data: StatusT) -> Self:
"""Create client status object from dict."""
return cls(
connection_status=ClientConnectionState(data["connectionStatus"].lower()),
state=ClientState(data["state"].lower()),
active=data["state"] == "active",
connected=data["connectionStatus"] == "connected",
)
|
class ClientStatus:
'''Represent client status.'''
@classmethod
def from_dict(cls, data: StatusT) -> Self:
'''Create client status object from dict.'''
pass
| 3 | 2 | 8 | 0 | 7 | 1 | 1 | 0.31 | 0 | 3 | 3 | 0 | 0 | 0 | 1 | 1 | 19 | 2 | 13 | 3 | 10 | 4 | 7 | 2 | 5 | 1 | 0 | 0 | 1 |
141,349 |
Kane610/axis
|
axis/models/light_control.py
|
axis.models.light_control.LightStatusT
|
class LightStatusT(TypedDict):
"""Light status."""
status: bool
|
class LightStatusT(TypedDict):
'''Light status.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,350 |
Kane610/axis
|
axis/models/event_instance.py
|
axis.models.event_instance.ListEventInstancesResponse
|
class ListEventInstancesResponse(ApiResponse[dict[str, Any]]):
"""Response object for listing all applications."""
data: dict[str, Any]
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare API description dictionary."""
data = xmltodict.parse(
bytes_data,
# attr_prefix="",
dict_constructor=dict, # Use dict rather than ordered_dict
namespaces=NAMESPACES, # Replace or remove defined namespaces
process_namespaces=True,
)
raw_events = traverse(data, EVENT_INSTANCE) # Move past the irrelevant keys
events = get_events(raw_events) # Create topic/data dictionary of events
return cls(data=EventInstance.decode_to_dict(events))
|
class ListEventInstancesResponse(ApiResponse[dict[str, Any]]):
'''Response object for listing all applications.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare API description dictionary.'''
pass
| 3 | 2 | 12 | 0 | 10 | 6 | 1 | 0.54 | 1 | 3 | 1 | 0 | 0 | 0 | 1 | 24 | 18 | 2 | 13 | 6 | 10 | 7 | 7 | 5 | 5 | 1 | 6 | 0 | 1 |
141,351 |
Kane610/axis
|
axis/models/applications/motion_guard.py
|
axis.models.applications.motion_guard.GetConfigurationRequest
|
class GetConfigurationRequest(ApiRequest):
"""Request object for listing Motion guard configuration."""
method = "post"
path = "/local/motionguard/control.cgi"
content_type = "application/json"
api_version: str = API_VERSION
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"apiVersion": self.api_version,
"context": self.context,
"method": "getConfiguration",
}
)
|
class GetConfigurationRequest(ApiRequest):
'''Request object for listing Motion guard configuration.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.13 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 20 | 3 | 15 | 8 | 12 | 2 | 8 | 7 | 6 | 1 | 1 | 0 | 1 |
141,352 |
Kane610/axis
|
axis/models/event_instance.py
|
axis.models.event_instance.EventInstance
|
class EventInstance(ApiItem):
"""Events are emitted when the Axis product detects an occurrence of some kind.
For example motion in camera field of view or a change of status from an I/O port.
The events can be used to trigger actions in the Axis product or in other systems
and can also be stored together with video and audio data for later access.
"""
topic: str
"""Event topic.
Event declaration namespace.
"""
topic_filter: str
"""Event topic.
Event topic filter namespace.
"""
is_available: bool
"""Means the event is available."""
is_application_data: bool
"""Indicate event and/or data is produced for specific system or application.
Events with isApplicationData=true are usually intended
to be used only by the specific system or application, that is,
they are not intended to be used as triggers in an action rule in the Axis product.
"""
name: str
"""User-friendly and human-readable name describing the event."""
stateful: bool
"""Stateful event is a property (a state variable) with a number of states.
The event is always in one of its states.
Example: The Motion detection event is in state true when motion is detected
and in state false when motion is not detected.
"""
stateless: bool
"""Stateless event is a momentary occurrence (a pulse).
Example: Storage device removed.
"""
source: dict[str, Any] | list[dict[str, Any]]
"""Event source information."""
data: dict[str, Any] | list[dict[str, Any]]
"""Event data description."""
@classmethod
def decode(cls, data: dict[str, Any]) -> Self:
"""Decode dict to class object."""
message = data["data"]["MessageInstance"]
return cls(
id=data["topic"],
topic=data["topic"],
topic_filter=data["topic"]
.replace("tns1", "onvif")
.replace("tnsaxis", "axis"),
is_available=data["data"]["@topic"] == "true",
is_application_data=data["data"].get("@isApplicationData") == "true",
name=data["data"].get("@NiceName", ""),
stateful=data["data"]["MessageInstance"].get("@isProperty") == "true",
stateless=data["data"]["MessageInstance"].get("@isProperty") != "true",
source=message.get("SourceInstance", {}).get("SimpleItemInstance", {}),
data=message.get("DataInstance", {}).get("SimpleItemInstance", {}),
)
|
class EventInstance(ApiItem):
'''Events are emitted when the Axis product detects an occurrence of some kind.
For example motion in camera field of view or a change of status from an I/O port.
The events can be used to trigger actions in the Axis product or in other systems
and can also be stored together with video and audio data for later access.
'''
@classmethod
def decode(cls, data: dict[str, Any]) -> Self:
'''Decode dict to class object.'''
pass
| 3 | 2 | 17 | 0 | 16 | 1 | 1 | 1.07 | 1 | 3 | 0 | 0 | 0 | 0 | 1 | 24 | 72 | 16 | 27 | 4 | 24 | 29 | 13 | 3 | 11 | 1 | 5 | 0 | 1 |
141,353 |
Kane610/axis
|
axis/models/api_discovery.py
|
axis.models.api_discovery.GetAllApisResponse
|
class GetAllApisResponse(ApiResponse[dict[str, Api]]):
"""Response object for basic device info."""
api_version: str
context: str
method: str
data: dict[str, Api]
# error: ErrorDataT | None = None
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare API description dictionary."""
data: ListApisResponseT = orjson.loads(bytes_data)
return cls(
api_version=data["apiVersion"],
context=data["context"],
method=data["method"],
data=Api.decode_to_dict(data["data"]["apiList"]),
)
|
class GetAllApisResponse(ApiResponse[dict[str, Api]]):
'''Response object for basic device info.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare API description dictionary.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.21 | 1 | 3 | 2 | 0 | 0 | 0 | 1 | 24 | 19 | 2 | 14 | 4 | 11 | 3 | 8 | 3 | 6 | 1 | 6 | 0 | 1 |
141,354 |
Kane610/axis
|
axis/models/api_discovery.py
|
axis.models.api_discovery.GetSupportedVersionsRequest
|
class GetSupportedVersionsRequest(ApiRequest):
"""Request object for listing supported API versions."""
method = "post"
path = "/axis-cgi/apidiscovery.cgi"
content_type = "application/json"
error_codes = error_codes
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"context": self.context,
"method": "getSupportedVersions",
}
)
|
class GetSupportedVersionsRequest(ApiRequest):
'''Request object for listing supported API versions.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 8 | 0 | 7 | 1 | 1 | 0.14 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 19 | 3 | 14 | 8 | 11 | 2 | 8 | 7 | 6 | 1 | 1 | 0 | 1 |
141,355 |
Kane610/axis
|
axis/models/api_discovery.py
|
axis.models.api_discovery.ListApisDataT
|
class ListApisDataT(TypedDict):
"""List of API description data."""
apiList: list[ApiDescriptionT]
|
class ListApisDataT(TypedDict):
'''List of API description data.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,356 |
Kane610/axis
|
axis/models/api_discovery.py
|
axis.models.api_discovery.ListApisRequest
|
class ListApisRequest(ApiRequest):
"""Request object for listing API descriptions."""
method = "post"
path = "/axis-cgi/apidiscovery.cgi"
content_type = "application/json"
error_codes = error_codes
api_version: str = API_VERSION
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"apiVersion": self.api_version,
"context": self.context,
"method": "getApiList",
}
)
|
class ListApisRequest(ApiRequest):
'''Request object for listing API descriptions.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.13 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 21 | 3 | 16 | 9 | 13 | 2 | 9 | 8 | 7 | 1 | 1 | 0 | 1 |
141,357 |
Kane610/axis
|
axis/models/api_discovery.py
|
axis.models.api_discovery.ListApisResponseT
|
class ListApisResponseT(TypedDict):
"""ListApis response."""
apiVersion: str
context: str
method: str
data: ListApisDataT
error: NotRequired[ErrorDataT]
|
class ListApisResponseT(TypedDict):
'''ListApis response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 6 | 1 | 5 | 1 | 6 | 1 | 5 | 0 | 1 | 0 | 0 |
141,358 |
Kane610/axis
|
axis/models/applications/application.py
|
axis.models.applications.application.Application
|
class Application(ApiItem):
"""Representation of an Application instance."""
application_id: str | None
"""Id of application."""
configuration_page: str | None
"""Relative URL to application configuration page."""
license_name: str
"""License name."""
license_status: ApplicationLicense
"""License status of application.
License status:
Valid = License is installed and valid.
Invalid = License is installed but not valid.
Missing = No license is installed.
Custom = Custom license is used. License status cannot be retrieved.
None = Application does not require any license.
"""
license_expiration_date: str
"""Date (YYYY-MM-DD) when the license expires."""
name: str
"""Name of application."""
nice_name: str
"""Name of application."""
status: ApplicationStatus
"""Status of application.
Application status:
Running = Application is running.
Stopped = Application is not running.
Idle = Application is idle.
"""
validation_result_page: str
"""Complete URL to a validation or result page."""
vendor: str
"""Vendor of application."""
vendor_page: str
"""Vendor of application."""
version: str
"""Version of application."""
@classmethod
def decode(cls, data: ApplicationObjectT) -> Self:
"""Decode dict to class object."""
return cls(
id=data["Name"],
application_id=data.get("ApplicationID"),
configuration_page=data.get("ConfigurationPage"),
license_name=data.get("LicenseName", ""),
license_status=ApplicationLicense(data["License"]),
license_expiration_date=data.get("LicenseExpirationDate", ""),
name=data["Name"],
nice_name=data["NiceName"],
status=ApplicationStatus(data["Status"]),
validation_result_page=data.get("ValidationResult", ""),
vendor=data["Vendor"],
vendor_page=data.get("VendorHomePage", ""),
version=data["Version"],
)
|
class Application(ApiItem):
'''Representation of an Application instance.'''
@classmethod
def decode(cls, data: ApplicationObjectT) -> Self:
'''Decode dict to class object.'''
pass
| 3 | 2 | 17 | 0 | 16 | 1 | 1 | 0.87 | 1 | 3 | 3 | 0 | 0 | 0 | 1 | 24 | 71 | 15 | 30 | 3 | 27 | 26 | 15 | 2 | 13 | 1 | 5 | 0 | 1 |
141,359 |
Kane610/axis
|
axis/models/applications/application.py
|
axis.models.applications.application.ApplicationLicense
|
class ApplicationLicense(enum.StrEnum):
"""Application license."""
VALID = "Valid"
INVALID = "Invalid"
MISSING = "Missing"
CUSTOM = "Custom"
NONE = "None"
|
class ApplicationLicense(enum.StrEnum):
'''Application license.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 68 | 8 | 1 | 6 | 6 | 5 | 1 | 6 | 6 | 5 | 0 | 3 | 0 | 0 |
141,360 |
Kane610/axis
|
axis/models/api_discovery.py
|
axis.models.api_discovery.ApiStatus
|
class ApiStatus(enum.StrEnum):
"""The API discovery status."""
OFFICIAL = "official"
RELEASED = "released"
BETA = "beta"
ALPHA = "alpha"
DEPRECATED = "deprecated"
UNKNOWN = "unknown"
@classmethod
def _missing_(cls, value: object) -> "ApiStatus":
"""Set default enum member if an unknown value is provided."""
LOGGER.debug("Unsupported API discovery status '%s'", value)
return ApiStatus.UNKNOWN
|
class ApiStatus(enum.StrEnum):
'''The API discovery status.'''
@classmethod
def _missing_(cls, value: object) -> "ApiStatus":
'''Set default enum member if an unknown value is provided.'''
pass
| 3 | 2 | 4 | 0 | 3 | 1 | 1 | 0.18 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 69 | 16 | 3 | 11 | 9 | 8 | 2 | 10 | 8 | 8 | 1 | 3 | 0 | 1 |
141,361 |
Kane610/axis
|
axis/models/applications/application.py
|
axis.models.applications.application.ApplicationName
|
class ApplicationName(enum.StrEnum):
"""Application name."""
FENCE_GUARD = "fenceguard"
LOITERING_GUARD = "loiteringguard"
MOTION_GUARD = "motionguard"
OBJECT_ANALYTICS = "objectanalytics"
VMD4 = "vmd"
|
class ApplicationName(enum.StrEnum):
'''Application name.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 68 | 8 | 1 | 6 | 6 | 5 | 1 | 6 | 6 | 5 | 0 | 3 | 0 | 0 |
141,362 |
Kane610/axis
|
axis/models/applications/application.py
|
axis.models.applications.application.ApplicationStatus
|
class ApplicationStatus(enum.StrEnum):
"""Application license."""
RUNNING = "Running"
STOPPED = "Stopped"
IDLE = "Idle"
|
class ApplicationStatus(enum.StrEnum):
'''Application license.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 68 | 6 | 1 | 4 | 4 | 3 | 1 | 4 | 4 | 3 | 0 | 3 | 0 | 0 |
141,363 |
Kane610/axis
|
axis/models/applications/application.py
|
axis.models.applications.application.ListApplicationDataT
|
class ListApplicationDataT(TypedDict):
"""List of applications root data."""
reply: NotRequired[ListApplicationReplyDataT]
|
class ListApplicationDataT(TypedDict):
'''List of applications root data.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,364 |
Kane610/axis
|
axis/models/applications/application.py
|
axis.models.applications.application.ListApplicationReplyDataT
|
class ListApplicationReplyDataT(TypedDict):
"""List applications response."""
application: NotRequired[list[ApplicationObjectT]]
result: Literal["ok", "error"]
|
class ListApplicationReplyDataT(TypedDict):
'''List applications response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 1 | 3 | 1 | 2 | 1 | 3 | 1 | 2 | 0 | 1 | 0 | 0 |
141,365 |
Kane610/axis
|
axis/models/applications/application.py
|
axis.models.applications.application.ListApplicationsRequest
|
class ListApplicationsRequest(ApiRequest):
"""Request object for listing installed applications."""
method = "post"
path = "/axis-cgi/applications/list.cgi"
content_type = "text/xml"
|
class ListApplicationsRequest(ApiRequest):
'''Request object for listing installed applications.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 6 | 1 | 4 | 4 | 3 | 1 | 4 | 4 | 3 | 0 | 1 | 0 | 0 |
141,366 |
Kane610/axis
|
axis/models/applications/application.py
|
axis.models.applications.application.ListApplicationsResponse
|
class ListApplicationsResponse(ApiResponse[dict[str, Application]]):
"""Response object for listing all applications."""
data: dict[str, Application]
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare API description dictionary."""
data = xmltodict.parse(bytes_data, attr_prefix="", force_list={"application"})
apps: list[ApplicationObjectT] = data.get("reply", {}).get("application", [])
return cls(data=Application.decode_to_dict(apps))
|
class ListApplicationsResponse(ApiResponse[dict[str, Application]]):
'''Response object for listing all applications.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare API description dictionary.'''
pass
| 3 | 2 | 5 | 0 | 4 | 1 | 1 | 0.29 | 1 | 4 | 2 | 0 | 0 | 0 | 1 | 24 | 11 | 2 | 7 | 5 | 4 | 2 | 6 | 4 | 4 | 1 | 6 | 0 | 1 |
141,367 |
Kane610/axis
|
axis/models/applications/fence_guard.py
|
axis.models.applications.fence_guard.Configuration
|
class Configuration(ApiItem):
"""Fence guard configuration."""
cameras: list[ConfigurationCameraDataT]
"""Cameras."""
profiles: dict[str, ProfileConfiguration]
"""Profiles"""
configuration_status: int
@classmethod
def decode(cls, data: ConfigurationDataT) -> Self:
"""Decode dict to class object."""
return cls(
id="fence guard",
cameras=data["cameras"],
profiles=ProfileConfiguration.decode_to_dict(data["profiles"]),
configuration_status=data["configurationStatus"],
)
|
class Configuration(ApiItem):
'''Fence guard configuration.'''
@classmethod
def decode(cls, data: ConfigurationDataT) -> Self:
'''Decode dict to class object.'''
pass
| 3 | 2 | 8 | 0 | 7 | 1 | 1 | 0.33 | 1 | 2 | 2 | 0 | 0 | 0 | 1 | 24 | 20 | 4 | 12 | 3 | 9 | 4 | 6 | 2 | 4 | 1 | 5 | 0 | 1 |
141,368 |
Kane610/axis
|
axis/models/applications/fence_guard.py
|
axis.models.applications.fence_guard.GetConfigurationRequest
|
class GetConfigurationRequest(ApiRequest):
"""Request object for listing Fence guard configuration."""
method = "post"
path = "/local/fenceguard/control.cgi"
content_type = "application/json"
api_version: str = API_VERSION
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"apiVersion": self.api_version,
"context": self.context,
"method": "getConfiguration",
}
)
|
class GetConfigurationRequest(ApiRequest):
'''Request object for listing Fence guard configuration.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.13 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 20 | 3 | 15 | 8 | 12 | 2 | 8 | 7 | 6 | 1 | 1 | 0 | 1 |
141,369 |
Kane610/axis
|
axis/models/applications/application.py
|
axis.models.applications.application.ApplicationObjectT
|
class ApplicationObjectT(TypedDict):
"""Application object description."""
ApplicationID: str
ConfigurationPage: str
LicenseName: NotRequired[str]
License: Literal["Valid", "Invalid", "Missing", "Custom", "None"]
LicenseExpirationDate: NotRequired[str]
Name: str
NiceName: str
Status: Literal["Running", "Stopped", "Idle"]
ValidationResult: NotRequired[str]
Vendor: str
VendorHomePage: NotRequired[str]
Version: str
|
class ApplicationObjectT(TypedDict):
'''Application object description.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.08 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 15 | 1 | 13 | 1 | 12 | 1 | 13 | 1 | 12 | 0 | 1 | 0 | 0 |
141,370 |
Kane610/axis
|
axis/models/api_discovery.py
|
axis.models.api_discovery.ApiId
|
class ApiId(enum.StrEnum):
"""The API discovery ID."""
ANALYTICS_METADATA_CONFIG = "analytics-metadata-config"
API_DISCOVERY = "api-discovery"
AUDIO_ANALYTICS = "audio-analytics"
AUDIO_DEVICE_CONTROL = "audio-device-control"
AUDIO_MIXER = "audio-mixer"
AUDIO_STREAMING_CAPABILITIES = "audio-streaming-capabilities"
BASIC_DEVICE_INFO = "basic-device-info"
CAPTURE_MODE = "capture-mode"
CUSTOM_HTTP_HEADER = "customhttpheader"
CUSTOM_FIRMWARE_CERTIFICATE = "custom-firmware-certificate"
DISK_MANAGEMENT = "disk-management"
DISK_NETWORK_SHARE = "disk-network-share"
DISK_PROPERTIES = "disk-properties"
DYNAMIC_OVERLAY = "dynamicoverlay"
EVENT_MQTT_BRIDGE = "event-mqtt-bridge"
EVENT_STREAMING_OVER_WEBSOCKET = "event-streaming-over-websocket"
FEATURE_FLAG = "feature-flag"
FIRMWARE_MANAGER = "fwmgr"
GUARD_TOUR = "guard-tour"
IMAGE_SIZE = "image-size"
IO_PORT_MANAGEMENT = "io-port-management"
LIGHT_CONTROL = "light-control"
MEDIA_CLIP = "mediaclip"
MDNS_SD = "mdnssd"
MQTT_CLIENT = "mqtt-client"
NETWORK_SETTINGS = "network-settings"
NETWORK_SPEAKER_PAIRING = "network-speaker-pairing"
NTP = "ntp"
OAK = "oak"
ON_SCREEN_CONTROLS = "onscreencontrols"
OVERLAY_IMAGE = "overlayimage"
PACKAGE_MANAGER = "packagemanager"
PARAM_CGI = "param-cgi"
PIR_SENSOR_CONFIGURATION = "pir-sensor-configuration"
PRIVACY_MASK = "privacy-mask"
PTZ_CONTROL = "ptz-control"
RECORDING = "recording"
RECORDING_EXPORT = "recording-export"
RECORDING_GROUP = "recording-group"
RECORDING_STORAGE_LIMIT = "recording-storage-limit"
REMOTE_SERVICE = "remoteservice"
REMOTE_SYSLOG = "remote-syslog"
RTSP_OVER_WEBSOCKET = "rtsp-over-websocket"
SHUTTERGAIN_CGI = "shuttergain-cgi"
SIGNED_VIDEO = "signed-video"
SIP = "sip"
SSH = "ssh"
STREAM_PROFILES = "stream-profiles"
SYSTEM_READY = "systemready"
TEMPERATURE_CONTROL = "temperaturecontrol"
TIME_SERVICE = "time-service"
UPNP = "upnp"
USER_MANAGEMENT = "user-management"
VIEW_AREA = "view-area"
ZIP_STREAM = "zipstream"
UNKNOWN = "unknown"
@classmethod
def _missing_(cls, value: object) -> "ApiId":
"""Set default enum member if an unknown value is provided."""
LOGGER.info("Unsupported API discovery ID '%s'", value)
return ApiId.UNKNOWN
|
class ApiId(enum.StrEnum):
'''The API discovery ID.'''
@classmethod
def _missing_(cls, value: object) -> "ApiId":
'''Set default enum member if an unknown value is provided.'''
pass
| 3 | 2 | 4 | 0 | 3 | 1 | 1 | 0.03 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 69 | 66 | 3 | 61 | 59 | 58 | 2 | 60 | 58 | 58 | 1 | 3 | 0 | 1 |
141,371 |
Kane610/axis
|
axis/models/api_discovery.py
|
axis.models.api_discovery.ApiDescriptionT
|
class ApiDescriptionT(TypedDict):
"""API description representation."""
docLink: str
id: str
name: str
status: NotRequired[str]
version: str
|
class ApiDescriptionT(TypedDict):
'''API description representation.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 6 | 1 | 5 | 1 | 6 | 1 | 5 | 0 | 1 | 0 | 0 |
141,372 |
Kane610/axis
|
axis/models/api_discovery.py
|
axis.models.api_discovery.Api
|
class Api(ApiItem):
"""API Discovery item."""
name: str
status: ApiStatus
version: str
@property
def api_id(self) -> ApiId:
"""ID of API."""
return ApiId(self.id)
@classmethod
def decode(cls, data: ApiDescriptionT) -> Self:
"""Decode dict to class object."""
return cls(
id=data["id"],
name=data["name"],
status=ApiStatus(data.get("status", "")),
version=data["version"],
)
|
class Api(ApiItem):
'''API Discovery item.'''
@property
def api_id(self) -> ApiId:
'''ID of API.'''
pass
@classmethod
def decode(cls, data: ApiDescriptionT) -> Self:
'''Decode dict to class object.'''
pass
| 5 | 3 | 6 | 0 | 5 | 1 | 1 | 0.2 | 1 | 3 | 3 | 0 | 1 | 0 | 2 | 25 | 21 | 3 | 15 | 5 | 10 | 3 | 8 | 3 | 5 | 1 | 5 | 0 | 2 |
141,373 |
Kane610/axis
|
axis/interfaces/parameters/io_port.py
|
axis.interfaces.parameters.io_port.IOPortParameterHandler
|
class IOPortParameterHandler(ParamHandler[IOPortParam]):
"""Handler for I/O port parameters."""
parameter_group = ParameterGroup.IOPORT
parameter_item = IOPortParam
|
class IOPortParameterHandler(ParamHandler[IOPortParam]):
'''Handler for I/O port parameters.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 25 | 5 | 1 | 3 | 3 | 2 | 1 | 3 | 3 | 2 | 0 | 3 | 0 | 0 |
141,374 |
Kane610/axis
|
axis/interfaces/parameters/param_cgi.py
|
axis.interfaces.parameters.param_cgi.Params
|
class Params(ApiHandler[Any]):
"""Represents all parameters of param.cgi."""
api_id = ApiId.PARAM_CGI
def __init__(self, vapix: "Vapix") -> None:
"""Initialize parameter classes."""
super().__init__(vapix)
self.brand_handler = BrandParameterHandler(self)
self.image_handler = ImageParameterHandler(self)
self.io_port_handler = IOPortParameterHandler(self)
self.property_handler = PropertyParameterHandler(self)
self.ptz_handler = PtzParameterHandler(self)
self.stream_profile_handler = StreamProfileParameterHandler(self)
async def _api_request(self, group: ParameterGroup | None = None) -> dict[str, Any]:
"""Fetch parameter data and convert it into a dictionary."""
bytes_data = await self.vapix.api_request(ParamRequest(group))
return params_to_dict(bytes_data.decode()).get("root") or {}
async def _update(self, group: ParameterGroup | None = None) -> Sequence[str]:
"""Request parameter data and update items."""
objects = await self._api_request(group)
self._items.update(objects)
self.initialized = True
return list(self.keys())
async def request_group(self, group: ParameterGroup | None = None) -> Sequence[str]:
"""Request parameter data and signal subscribers."""
if obj_ids := await self._update(group):
for obj_id in obj_ids:
self.signal_subscribers(obj_id)
return obj_ids
|
class Params(ApiHandler[Any]):
'''Represents all parameters of param.cgi.'''
def __init__(self, vapix: "Vapix") -> None:
'''Initialize parameter classes.'''
pass
async def _api_request(self, group: ParameterGroup | None = None) -> dict[str, Any]:
'''Fetch parameter data and convert it into a dictionary.'''
pass
async def _update(self, group: ParameterGroup | None = None) -> Sequence[str]:
'''Request parameter data and update items.'''
pass
async def request_group(self, group: ParameterGroup | None = None) -> Sequence[str]:
'''Request parameter data and signal subscribers.'''
pass
| 5 | 5 | 7 | 0 | 5 | 1 | 2 | 0.22 | 1 | 14 | 8 | 0 | 4 | 7 | 4 | 25 | 34 | 6 | 23 | 17 | 18 | 5 | 23 | 16 | 18 | 3 | 2 | 2 | 6 |
141,375 |
Kane610/axis
|
axis/interfaces/parameters/param_handler.py
|
axis.interfaces.parameters.param_handler.ParamHandler
|
class ParamHandler(ApiHandler[ParamItemT]):
"""Base class for a map of API Items."""
parameter_group: ParameterGroup
parameter_item: type[ParamItemT]
def __init__(self, param_handler: "Params") -> None:
"""Initialize API items."""
super().__init__(param_handler.vapix)
param_handler.subscribe(self._update_params_callback, self.parameter_group)
@property
def listed_in_parameters(self) -> bool:
"""Is parameter group supported."""
return self.vapix.params.get(self.parameter_group) is not None
async def _update(self) -> Sequence[str]:
"""Request parameter group data from parameter handler.
This method returns after _update_params_callback has updated items.
"""
return await self.vapix.params.request_group(self.parameter_group)
def _update_params_callback(self, obj_id: str) -> None:
"""Update parameter data from parameter handler subscription."""
if data := self.vapix.params.get(self.parameter_group):
self._items.update(self.parameter_item.decode_to_dict([data]))
self.initialized = True
|
class ParamHandler(ApiHandler[ParamItemT]):
'''Base class for a map of API Items.'''
def __init__(self, param_handler: "Params") -> None:
'''Initialize API items.'''
pass
@property
def listed_in_parameters(self) -> bool:
'''Is parameter group supported.'''
pass
async def _update(self) -> Sequence[str]:
'''Request parameter group data from parameter handler.
This method returns after _update_params_callback has updated items.
'''
pass
def _update_params_callback(self, obj_id: str) -> None:
'''Update parameter data from parameter handler subscription.'''
pass
| 6 | 5 | 5 | 0 | 3 | 2 | 1 | 0.47 | 1 | 4 | 0 | 6 | 4 | 1 | 4 | 25 | 28 | 6 | 15 | 8 | 9 | 7 | 14 | 6 | 9 | 2 | 2 | 1 | 5 |
141,376 |
Kane610/axis
|
axis/interfaces/parameters/properties.py
|
axis.interfaces.parameters.properties.PropertyParameterHandler
|
class PropertyParameterHandler(ParamHandler[PropertyParam]):
"""Handler for property parameters."""
parameter_group = ParameterGroup.PROPERTIES
parameter_item = PropertyParam
|
class PropertyParameterHandler(ParamHandler[PropertyParam]):
'''Handler for property parameters.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 25 | 5 | 1 | 3 | 3 | 2 | 1 | 3 | 3 | 2 | 0 | 3 | 0 | 0 |
141,377 |
Kane610/axis
|
axis/interfaces/parameters/ptz.py
|
axis.interfaces.parameters.ptz.PtzParameterHandler
|
class PtzParameterHandler(ParamHandler[PtzParam]):
"""Handler for PTZ parameters."""
parameter_group = ParameterGroup.PTZ
parameter_item = PtzParam
|
class PtzParameterHandler(ParamHandler[PtzParam]):
'''Handler for PTZ parameters.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 25 | 5 | 1 | 3 | 3 | 2 | 1 | 3 | 3 | 2 | 0 | 3 | 0 | 0 |
141,378 |
Kane610/axis
|
axis/interfaces/parameters/stream_profile.py
|
axis.interfaces.parameters.stream_profile.StreamProfileParameterHandler
|
class StreamProfileParameterHandler(ParamHandler[StreamProfileParam]):
"""Handler for stream profile parameters."""
parameter_group = ParameterGroup.STREAMPROFILE
parameter_item = StreamProfileParam
|
class StreamProfileParameterHandler(ParamHandler[StreamProfileParam]):
'''Handler for stream profile parameters.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 25 | 5 | 1 | 3 | 3 | 2 | 1 | 3 | 3 | 2 | 0 | 3 | 0 | 0 |
141,379 |
Kane610/axis
|
axis/interfaces/pir_sensor_configuration.py
|
axis.interfaces.pir_sensor_configuration.PirSensorConfigurationHandler
|
class PirSensorConfigurationHandler(ApiHandler[PirSensorConfiguration]):
"""PIR sensor configuration for Axis devices."""
api_id = ApiId.PIR_SENSOR_CONFIGURATION
default_api_version = API_VERSION
async def _api_request(self) -> dict[str, PirSensorConfiguration]:
"""Get default data of PIR sensor configuration."""
return await self.list_sensors()
async def list_sensors(self) -> dict[str, PirSensorConfiguration]:
"""List all PIR sensors of device."""
discovery_item = self.vapix.api_discovery[self.api_id]
bytes_data = await self.vapix.api_request(
ListSensorsRequest(discovery_item.version)
)
response = ListSensorsResponse.decode(bytes_data)
return response.data
async def get_sensitivity(self, id: int) -> float | None:
"""Retrieve configured sensitivity of specific sensor."""
discovery_item = self.vapix.api_discovery[self.api_id]
bytes_data = await self.vapix.api_request(
GetSensitivityRequest(id, discovery_item.version)
)
response = GetSensitivityResponse.decode(bytes_data)
return response.data
async def set_sensitivity(self, id: int, sensitivity: float) -> None:
"""Configure sensitivity of specific sensor."""
discovery_item = self.vapix.api_discovery[self.api_id]
await self.vapix.api_request(
SetSensitivityRequest(id, sensitivity, discovery_item.version)
)
async def get_supported_versions(self) -> list[str]:
"""List supported API versions."""
bytes_data = await self.vapix.api_request(GetSupportedVersionsRequest())
response = GetSupportedVersionsResponse.decode(bytes_data)
return response.data
|
class PirSensorConfigurationHandler(ApiHandler[PirSensorConfiguration]):
'''PIR sensor configuration for Axis devices.'''
async def _api_request(self) -> dict[str, PirSensorConfiguration]:
'''Get default data of PIR sensor configuration.'''
pass
async def list_sensors(self) -> dict[str, PirSensorConfiguration]:
'''List all PIR sensors of device.'''
pass
async def get_sensitivity(self, id: int) -> float | None:
'''Retrieve configured sensitivity of specific sensor.'''
pass
async def set_sensitivity(self, id: int, sensitivity: float) -> None:
'''Configure sensitivity of specific sensor.'''
pass
async def get_supported_versions(self) -> list[str]:
'''List supported API versions.'''
pass
| 6 | 6 | 6 | 0 | 5 | 1 | 1 | 0.21 | 1 | 13 | 8 | 0 | 5 | 0 | 5 | 26 | 40 | 6 | 28 | 17 | 22 | 6 | 22 | 17 | 16 | 1 | 2 | 0 | 5 |
141,380 |
Kane610/axis
|
axis/interfaces/port_cgi.py
|
axis.interfaces.port_cgi.Ports
|
class Ports(ApiHandler[IOPortParam]):
"""Represents all ports of io/port.cgi."""
@property
def listed_in_parameters(self) -> bool:
"""Is API listed in parameters."""
return self.vapix.params.io_port_handler.listed_in_parameters
async def _api_request(self) -> dict[str, IOPortParam]:
"""Get API data method defined by subclass."""
return await self.get_ports()
async def get_ports(self) -> dict[str, IOPortParam]:
"""Retrieve privilege rights for current user."""
await self.vapix.params.io_port_handler.update()
return self.process_ports()
def load_ports(self) -> None:
"""Load ports into class."""
self._items.update(self.process_ports())
def process_ports(self) -> dict[str, IOPortParam]:
"""Process ports from I/O port handler."""
return dict(self.vapix.params.io_port_handler.items())
async def action(self, id: str, action: PortAction) -> None:
"""Activate or deactivate an output."""
if (port := self[id]) and port.direction != PortDirection.OUT:
return
await self.vapix.api_request(PortActionRequest(id, action))
async def open(self, id: str) -> None:
"""Open port."""
await self.action(id, PortAction.LOW)
async def close(self, id: str) -> None:
"""Close port."""
await self.action(id, PortAction.HIGH)
|
class Ports(ApiHandler[IOPortParam]):
'''Represents all ports of io/port.cgi.'''
@property
def listed_in_parameters(self) -> bool:
'''Is API listed in parameters.'''
pass
async def _api_request(self) -> dict[str, IOPortParam]:
'''Get API data method defined by subclass.'''
pass
async def get_ports(self) -> dict[str, IOPortParam]:
'''Retrieve privilege rights for current user.'''
pass
def load_ports(self) -> None:
'''Load ports into class.'''
pass
def process_ports(self) -> dict[str, IOPortParam]:
'''Process ports from I/O port handler.'''
pass
async def action(self, id: str, action: PortAction) -> None:
'''Activate or deactivate an output.'''
pass
async def open(self, id: str) -> None:
'''Open port.'''
pass
async def close(self, id: str) -> None:
'''Close port.'''
pass
| 10 | 9 | 3 | 0 | 2 | 1 | 1 | 0.43 | 1 | 7 | 4 | 0 | 8 | 0 | 8 | 29 | 38 | 8 | 21 | 11 | 11 | 9 | 20 | 9 | 11 | 2 | 2 | 1 | 9 |
141,381 |
Kane610/axis
|
axis/interfaces/port_management.py
|
axis.interfaces.port_management.IoPortManagement
|
class IoPortManagement(ApiHandler[Port]):
"""I/O port management for Axis devices."""
api_id = ApiId.IO_PORT_MANAGEMENT
default_api_version = API_VERSION
async def _api_request(self) -> dict[str, Port]:
"""Get default data of I/O port management."""
return await self.get_ports()
async def get_ports(self) -> dict[str, Port]:
"""List ports."""
bytes_data = await self.vapix.api_request(GetPortsRequest())
return GetPortsResponse.decode(bytes_data).data
async def set_ports(
self, ports: list[PortConfiguration] | PortConfiguration
) -> None:
"""Configure one or more ports.
Some of the available options are:
* Setting a nice name that can be used in the user interface.
* Configuring the states and what constitutes a normal
and triggered state respectively.
This will make triggers activate in either open or closed circuits.
The reason the change is treated as a nice name is because it doesn't
affect the underlying behavior of the port.
Devices with configurable ports can change the direction
to either input or output.
"""
await self.vapix.api_request(SetPortsRequest(ports))
async def set_state_sequence(self, port_id: str, sequence: list[Sequence]) -> None:
"""Apply a sequence of state changes with a delay in milliseconds between states."""
await self.vapix.api_request(SetStateSequenceRequest(port_id, sequence))
async def get_supported_versions(self) -> list[str]:
"""List supported API versions."""
bytes_data = await self.vapix.api_request(GetSupportedVersionsRequest())
return GetSupportedVersionsResponse.decode(bytes_data).data
async def open(self, port_id: str) -> None:
"""Shortcut method to open a port."""
await self.set_ports(PortConfiguration(port_id, state="open"))
async def close(self, port_id: str) -> None:
"""Shortcut method to close a port."""
await self.set_ports(PortConfiguration(port_id, state="closed"))
|
class IoPortManagement(ApiHandler[Port]):
'''I/O port management for Axis devices.'''
async def _api_request(self) -> dict[str, Port]:
'''Get default data of I/O port management.'''
pass
async def get_ports(self) -> dict[str, Port]:
'''List ports.'''
pass
async def set_ports(
self, ports: list[PortConfiguration] | PortConfiguration
) -> None:
'''Configure one or more ports.
Some of the available options are:
* Setting a nice name that can be used in the user interface.
* Configuring the states and what constitutes a normal
and triggered state respectively.
This will make triggers activate in either open or closed circuits.
The reason the change is treated as a nice name is because it doesn't
affect the underlying behavior of the port.
Devices with configurable ports can change the direction
to either input or output.
'''
pass
async def set_state_sequence(self, port_id: str, sequence: list[Sequence]) -> None:
'''Apply a sequence of state changes with a delay in milliseconds between states.'''
pass
async def get_supported_versions(self) -> list[str]:
'''List supported API versions.'''
pass
async def open(self, port_id: str) -> None:
'''Shortcut method to open a port.'''
pass
async def close(self, port_id: str) -> None:
'''Shortcut method to close a port.'''
pass
| 8 | 8 | 5 | 0 | 3 | 2 | 1 | 0.86 | 1 | 12 | 9 | 0 | 7 | 0 | 7 | 28 | 48 | 9 | 21 | 14 | 11 | 18 | 19 | 12 | 11 | 1 | 2 | 0 | 7 |
141,382 |
Kane610/axis
|
axis/interfaces/ptz.py
|
axis.interfaces.ptz.PtzControl
|
class PtzControl(ApiHandler[PtzParam]):
"""Configure and control the PTZ functionality."""
async def _api_request(self) -> dict[str, PtzParam]:
"""Get API data method defined by subclass."""
return await self.get_ptz()
async def get_ptz(self) -> dict[str, PtzParam]:
"""Retrieve privilege rights for current user."""
await self.vapix.params.ptz_handler.update()
return self.process_ptz()
def process_ptz(self) -> dict[str, PtzParam]:
"""Process ports."""
return dict(self.vapix.params.ptz_handler.items())
async def control(
self,
camera: int | None = None,
center: tuple[int, int] | None = None,
area_zoom: tuple[int, int, int] | None = None,
image_width: int | None = None,
image_height: int | None = None,
move: PtzMove | None = None,
pan: float | None = None,
tilt: float | None = None,
zoom: int | None = None,
focus: int | None = None,
iris: int | None = None,
brightness: int | None = None,
relative_pan: float | None = None,
relative_tilt: float | None = None,
relative_zoom: int | None = None,
relative_focus: int | None = None,
relative_iris: int | None = None,
relative_brightness: int | None = None,
auto_focus: bool | None = None,
auto_iris: bool | None = None,
continuous_pantilt_move: tuple[int, int] | None = None,
continuous_zoom_move: int | None = None,
continuous_focus_move: int | None = None,
continuous_iris_move: int | None = None,
continuous_brightness_move: int | None = None,
auxiliary: str | None = None,
go_to_server_preset_name: str | None = None,
go_to_server_preset_number: int | None = None,
go_to_device_preset: int | None = None,
speed: int | None = None,
image_rotation: PtzRotation | None = None,
ir_cut_filter: PtzState | None = None,
backlight: bool | None = None,
) -> None:
"""Control the pan, tilt and zoom behavior of a PTZ unit."""
await self.vapix.api_request(
PtzControlRequest(
camera=camera,
center=center,
area_zoom=area_zoom,
image_width=image_width,
image_height=image_height,
move=move,
pan=pan,
tilt=tilt,
zoom=zoom,
focus=focus,
iris=iris,
brightness=brightness,
relative_pan=relative_pan,
relative_tilt=relative_tilt,
relative_zoom=relative_zoom,
relative_focus=relative_focus,
relative_iris=relative_iris,
relative_brightness=relative_brightness,
auto_focus=auto_focus,
auto_iris=auto_iris,
continuous_pantilt_move=continuous_pantilt_move,
continuous_zoom_move=continuous_zoom_move,
continuous_focus_move=continuous_focus_move,
continuous_iris_move=continuous_iris_move,
continuous_brightness_move=continuous_brightness_move,
auxiliary=auxiliary,
go_to_server_preset_name=go_to_server_preset_name,
go_to_server_preset_number=go_to_server_preset_number,
go_to_device_preset=go_to_device_preset,
speed=speed,
image_rotation=image_rotation,
ir_cut_filter=ir_cut_filter,
backlight=backlight,
)
)
async def query(self, query: PtzQuery) -> bytes:
"""Retrieve current status."""
return await self.vapix.api_request(QueryRequest(query))
async def configured_device_driver(self) -> bytes:
"""Name of the system-configured device driver."""
return await self.vapix.api_request(DeviceDriverRequest())
async def available_ptz_commands(self) -> bytes:
"""Available PTZ commands."""
return await self.vapix.api_request(PtzCommandRequest())
|
class PtzControl(ApiHandler[PtzParam]):
'''Configure and control the PTZ functionality.'''
async def _api_request(self) -> dict[str, PtzParam]:
'''Get API data method defined by subclass.'''
pass
async def get_ptz(self) -> dict[str, PtzParam]:
'''Retrieve privilege rights for current user.'''
pass
def process_ptz(self) -> dict[str, PtzParam]:
'''Process ports.'''
pass
async def control(
self,
camera: int | None = None,
center: tuple[int, int] | None = None,
area_zoom: tuple[int, int, int] | None = None,
image_width: int | None = None,
image_height: int | None = None,
move: PtzMove | None = None,
pan: float | None = None,
tilt: float | None = None,
zoom: int | None = None,
focus: int | None = None,
iris: int | None = None,
brightness: int | None = None,
relative_pan: float | None = None,
relative_tilt: float | None = None,
relative_zoom: int | None = None,
relative_focus: int | None = None,
relative_iris: int | None = None,
relative_brightness: int | None = None,
auto_focus: bool | None = None,
auto_iris: bool | None = None,
continuous_pantilt_move: tuple[int, int] | None = None,
continuous_zoom_move: int | None = None,
continuous_focus_move: int | None = None,
continuous_iris_move: int | None = None,
continuous_brightness_move: int | None = None,
auxiliary: str | None = None,
go_to_server_preset_name: str | None = None,
go_to_server_preset_number: int | None = None,
go_to_device_preset: int | None = None,
speed: int | None = None,
image_rotation: PtzRotation | None = None,
ir_cut_filter: PtzState | None = None,
backlight: bool | None = None,
) -> None:
'''Control the pan, tilt and zoom behavior of a PTZ unit.'''
pass
async def query(self, query: PtzQuery) -> bytes:
'''Retrieve current status.'''
pass
async def configured_device_driver(self) -> bytes:
'''Name of the system-configured device driver.'''
pass
async def available_ptz_commands(self) -> bytes:
'''Available PTZ commands.'''
pass
| 8 | 8 | 13 | 0 | 12 | 1 | 1 | 0.09 | 1 | 16 | 9 | 0 | 7 | 0 | 7 | 28 | 102 | 7 | 87 | 43 | 44 | 8 | 16 | 8 | 8 | 1 | 2 | 0 | 7 |
141,383 |
Kane610/axis
|
axis/interfaces/pwdgrp_cgi.py
|
axis.interfaces.pwdgrp_cgi.Users
|
class Users(ApiHandler[User]):
"""Represents all users of a device."""
api_id = ApiId.USER_MANAGEMENT
@property
def listed_in_parameters(self) -> bool:
"""Is pwdgrp.cgi supported."""
return self.vapix.params.property_handler.supported and (
self.vapix.params.property_handler["0"].api_http_version >= 3
)
async def _api_request(self) -> dict[str, User]:
"""Get default data of basic device information."""
return await self.list()
async def list(self) -> dict[str, User]:
"""List current users."""
data = await self.vapix.api_request(GetUsersRequest())
return GetUsersResponse.decode(data).data
async def create(
self,
user: str,
*,
pwd: str,
sgrp: SecondaryGroup,
comment: str | None = None,
) -> None:
"""Create new user."""
await self.vapix.api_request(CreateUserRequest(user, pwd, sgrp, comment))
async def modify(
self,
user: str,
*,
pwd: str | None = None,
sgrp: SecondaryGroup | None = None,
comment: str | None = None,
) -> None:
"""Update user."""
await self.vapix.api_request(ModifyUserRequest(user, pwd, sgrp, comment))
async def delete(self, user: str) -> None:
"""Remove user."""
await self.vapix.api_request(DeleteUserRequest(user))
|
class Users(ApiHandler[User]):
'''Represents all users of a device.'''
@property
def listed_in_parameters(self) -> bool:
'''Is pwdgrp.cgi supported.'''
pass
async def _api_request(self) -> dict[str, User]:
'''Get default data of basic device information.'''
pass
def listed_in_parameters(self) -> bool:
'''List current users.'''
pass
async def create(
self,
user: str,
*,
pwd: str,
sgrp: SecondaryGroup,
comment: str | None = None,
) -> None:
'''Create new user.'''
pass
async def modify(
self,
user: str,
*,
pwd: str | None = None,
sgrp: SecondaryGroup | None = None,
comment: str | None = None,
) -> None:
'''Update user.'''
pass
async def delete(self, user: str) -> None:
'''Remove user.'''
pass
| 8 | 7 | 6 | 0 | 5 | 1 | 1 | 0.22 | 1 | 10 | 7 | 0 | 6 | 0 | 6 | 27 | 46 | 7 | 32 | 24 | 10 | 7 | 15 | 9 | 8 | 1 | 2 | 0 | 6 |
141,384 |
Kane610/axis
|
axis/interfaces/stream_profiles.py
|
axis.interfaces.stream_profiles.StreamProfilesHandler
|
class StreamProfilesHandler(ApiHandler[StreamProfile]):
"""API Discovery for Axis devices."""
api_id = ApiId.STREAM_PROFILES
default_api_version = API_VERSION
async def _api_request(self) -> dict[str, StreamProfile]:
"""Get default data of stream profiles."""
return await self.list_stream_profiles()
async def list_stream_profiles(self) -> dict[str, StreamProfile]:
"""List all stream profiles."""
discovery_item = self.vapix.api_discovery[self.api_id]
bytes_data = await self.vapix.api_request(
ListStreamProfilesRequest(api_version=discovery_item.version)
)
response = ListStreamProfilesResponse.decode(bytes_data)
return response.data
async def get_supported_versions(self) -> list[str]:
"""List supported API versions."""
bytes_data = await self.vapix.api_request(GetSupportedVersionsRequest())
response = GetSupportedVersionsResponse.decode(bytes_data)
return response.data
|
class StreamProfilesHandler(ApiHandler[StreamProfile]):
'''API Discovery for Axis devices.'''
async def _api_request(self) -> dict[str, StreamProfile]:
'''Get default data of stream profiles.'''
pass
async def list_stream_profiles(self) -> dict[str, StreamProfile]:
'''List all stream profiles.'''
pass
async def get_supported_versions(self) -> list[str]:
'''List supported API versions.'''
pass
| 4 | 4 | 5 | 0 | 4 | 1 | 1 | 0.25 | 1 | 8 | 5 | 0 | 3 | 0 | 3 | 24 | 24 | 4 | 16 | 11 | 12 | 4 | 14 | 11 | 10 | 1 | 2 | 0 | 3 |
141,385 |
Kane610/axis
|
axis/interfaces/user_groups.py
|
axis.interfaces.user_groups.UserGroups
|
class UserGroups(ApiHandler[User]):
"""User group access rights for Axis devices."""
async def _api_request(self) -> dict[str, User]:
"""Get API data method defined by subclass."""
return await self.get_user_groups()
async def get_user_groups(self) -> dict[str, User]:
"""Retrieve privilege rights for current user."""
bytes_data = await self.vapix.api_request(GetUserGroupRequest())
return GetUserGroupResponse.decode(bytes_data).data
|
class UserGroups(ApiHandler[User]):
'''User group access rights for Axis devices.'''
async def _api_request(self) -> dict[str, User]:
'''Get API data method defined by subclass.'''
pass
async def get_user_groups(self) -> dict[str, User]:
'''Retrieve privilege rights for current user.'''
pass
| 3 | 3 | 4 | 0 | 3 | 1 | 1 | 0.5 | 1 | 5 | 3 | 0 | 2 | 0 | 2 | 23 | 11 | 2 | 6 | 4 | 3 | 3 | 6 | 4 | 3 | 1 | 2 | 0 | 2 |
141,386 |
Kane610/axis
|
axis/interfaces/vapix.py
|
axis.interfaces.vapix.Vapix
|
class Vapix:
"""Vapix parameter request."""
def __init__(self, device: AxisDevice) -> None:
"""Store local reference to device config."""
self.device = device
self.auth = httpx.DigestAuth(device.config.username, device.config.password)
self.users = Users(self)
self.user_groups = UserGroups(self)
self.api_discovery: ApiDiscoveryHandler = ApiDiscoveryHandler(self)
self.params: Params = Params(self)
self.basic_device_info = BasicDeviceInfoHandler(self)
self.io_port_management = IoPortManagement(self)
self.light_control = LightHandler(self)
self.mqtt = MqttClientHandler(self)
self.pir_sensor_configuration = PirSensorConfigurationHandler(self)
self.stream_profiles = StreamProfilesHandler(self)
self.view_areas = ViewAreaHandler(self)
self.port_cgi = Ports(self)
self.ptz = PtzControl(self)
self.applications: ApplicationsHandler = ApplicationsHandler(self)
self.fence_guard = FenceGuardHandler(self)
self.loitering_guard = LoiteringGuardHandler(self)
self.motion_guard = MotionGuardHandler(self)
self.object_analytics = ObjectAnalyticsHandler(self)
self.vmd4 = Vmd4Handler(self)
self.event_instances = EventInstanceHandler(self)
@property
def firmware_version(self) -> str:
"""Firmware version of device."""
if self.basic_device_info.initialized:
return self.basic_device_info["0"].firmware_version
if self.params.property_handler.initialized:
return self.params.property_handler["0"].firmware_version
return ""
@property
def product_number(self) -> str:
"""Product number of device."""
if self.basic_device_info.initialized:
return self.basic_device_info["0"].product_number
if self.params.brand_handler.initialized:
return self.params.brand_handler["0"].product_number
return ""
@property
def product_type(self) -> str:
"""Product type of device."""
if self.basic_device_info.initialized:
return self.basic_device_info["0"].product_type
if self.params.brand_handler.initialized:
return self.params.brand_handler["0"].product_type
return ""
@property
def serial_number(self) -> str:
"""Device serial number."""
if self.basic_device_info.initialized:
return self.basic_device_info["0"].serial_number
if self.params.property_handler.initialized:
return self.params.property_handler["0"].system_serial_number
return ""
@property
def access_rights(self) -> SecondaryGroup:
"""Access rights with the account."""
if user := self.user_groups.get("0"):
return user.privileges
return SecondaryGroup.UNKNOWN
@property
def streaming_profiles(self) -> list[StreamProfile]:
"""List streaming profiles."""
if self.stream_profiles.initialized:
return list(self.stream_profiles.values())
if self.params.stream_profile_handler.initialized:
return self.params.stream_profile_handler["0"].stream_profiles
return []
@property
def ports(self) -> IoPortManagement | Ports:
"""Temporary port property."""
if self.io_port_management.supported:
return self.io_port_management
return self.port_cgi
async def initialize(self) -> None:
"""Initialize Vapix functions."""
await self.initialize_api_discovery()
await self.initialize_param_cgi(preload_data=False)
await self.initialize_applications()
async def initialize_api_discovery(self) -> None:
"""Load API list from API Discovery."""
if not await self.api_discovery.update():
return
apis: tuple[ApiHandler[Any], ...] = (
self.basic_device_info,
self.io_port_management,
self.light_control,
self.mqtt,
self.pir_sensor_configuration,
self.stream_profiles,
self.view_areas,
)
await asyncio.gather(*[api.update() for api in apis if api.supported])
async def initialize_param_cgi(self, preload_data: bool = True) -> None:
"""Load data from param.cgi."""
tasks = []
if preload_data:
tasks.append(self.params.update())
else:
tasks.append(self.params.property_handler.update())
if (
not self.basic_device_info.supported
or not self.basic_device_info.initialized
):
tasks.append(self.params.brand_handler.update())
if not self.io_port_management.supported:
tasks.append(self.params.io_port_handler.update())
if not self.stream_profiles.supported:
tasks.append(self.params.stream_profile_handler.update())
if self.view_areas.supported:
tasks.append(self.params.image_handler.update())
await asyncio.gather(*tasks)
if not self.params.property_handler.supported:
return
if (
not self.light_control.listed_in_api_discovery
and self.light_control.listed_in_parameters
):
await self.light_control.update()
if not self.io_port_management.supported and self.port_cgi.supported:
self.port_cgi.load_ports()
if self.params.property_handler["0"].ptz:
await self.params.ptz_handler.update()
async def initialize_applications(self) -> None:
"""Load data for applications on device."""
if not self.applications.supported or not await self.applications.update():
return
apps: tuple[ApiHandler[Any], ...] = (
self.fence_guard,
self.loitering_guard,
self.motion_guard,
self.object_analytics,
self.vmd4,
)
await asyncio.gather(*[app.update() for app in apps if app.supported])
async def initialize_event_instances(self) -> None:
"""Initialize event instances of what events are supported by the device."""
await self.event_instances.update()
async def initialize_users(self) -> None:
"""Load device user data and initialize user management."""
await self.users.update()
async def load_user_groups(self) -> None:
"""Load user groups to know the access rights of the user.
If information is available from pwdgrp.cgi use that.
"""
user_groups = {}
if len(self.users) > 0 and self.device.config.username in self.users:
user_groups = {"0": self.users[self.device.config.username]}
if not user_groups and await self.user_groups.update():
return
self.user_groups._items.update(user_groups)
async def api_request(self, api_request: ApiRequest) -> bytes:
"""Make a request to the device."""
return await self.request(
method=api_request.method,
path=api_request.path,
content=api_request.content,
data=api_request.data,
headers=api_request.headers,
params=api_request.params,
)
async def request(
self,
method: str,
path: str,
content: bytes | None = None,
data: dict[str, str] | None = None,
headers: dict[str, str] | None = None,
params: dict[str, str] | None = None,
) -> bytes:
"""Make a request to the device."""
url = self.device.config.url + path
LOGGER.debug("%s, %s, '%s', '%s', '%s'", method, url, content, data, params)
try:
response = await self.device.config.session.request(
method,
url,
content=content,
data=data,
headers=headers,
params=params,
auth=self.auth,
timeout=TIME_OUT,
)
except httpx.TimeoutException as errt:
message = "Timeout"
raise RequestError(message) from errt
except httpx.TransportError as errc:
LOGGER.debug("%s", errc)
message = f"Connection error: {errc}"
raise RequestError(message) from errc
except httpx.RequestError as err:
LOGGER.debug("%s", err)
message = f"Unknown error: {err}"
raise RequestError(message) from err
try:
response.raise_for_status()
except httpx.HTTPStatusError as errh:
LOGGER.debug("%s, %s", response, errh)
raise_error(response.status_code)
LOGGER.debug(
"Response (from %s %s): %s",
self.device.config.host,
path,
response.content,
)
return response.content
|
class Vapix:
'''Vapix parameter request.'''
def __init__(self, device: AxisDevice) -> None:
'''Store local reference to device config.'''
pass
@property
def firmware_version(self) -> str:
'''Firmware version of device.'''
pass
@property
def product_number(self) -> str:
'''Product number of device.'''
pass
@property
def product_type(self) -> str:
'''Product type of device.'''
pass
@property
def serial_number(self) -> str:
'''Device serial number.'''
pass
@property
def access_rights(self) -> SecondaryGroup:
'''Access rights with the account.'''
pass
@property
def streaming_profiles(self) -> list[StreamProfile]:
'''List streaming profiles.'''
pass
@property
def ports(self) -> IoPortManagement | Ports:
'''Temporary port property.'''
pass
async def initialize(self) -> None:
'''Initialize Vapix functions.'''
pass
async def initialize_api_discovery(self) -> None:
'''Load API list from API Discovery.'''
pass
async def initialize_param_cgi(self, preload_data: bool = True) -> None:
'''Load data from param.cgi.'''
pass
async def initialize_applications(self) -> None:
'''Load data for applications on device.'''
pass
async def initialize_event_instances(self) -> None:
'''Initialize event instances of what events are supported by the device.'''
pass
async def initialize_users(self) -> None:
'''Load device user data and initialize user management.'''
pass
async def load_user_groups(self) -> None:
'''Load user groups to know the access rights of the user.
If information is available from pwdgrp.cgi use that.
'''
pass
async def api_request(self, api_request: ApiRequest) -> bytes:
'''Make a request to the device.'''
pass
async def request(
self,
method: str,
path: str,
content: bytes | None = None,
data: dict[str, str] | None = None,
headers: dict[str, str] | None = None,
params: dict[str, str] | None = None,
) -> bytes:
'''Make a request to the device.'''
pass
| 25 | 18 | 14 | 2 | 11 | 1 | 3 | 0.1 | 0 | 32 | 25 | 0 | 17 | 22 | 17 | 17 | 257 | 46 | 191 | 67 | 158 | 20 | 134 | 47 | 116 | 10 | 0 | 2 | 46 |
141,387 |
Kane610/axis
|
axis/interfaces/view_areas.py
|
axis.interfaces.view_areas.ViewAreaHandler
|
class ViewAreaHandler(ApiHandler[ViewArea]):
"""View areas for Axis devices."""
api_id = ApiId.VIEW_AREA
async def _api_request(self) -> dict[str, ViewArea]:
"""Get default data of stream profiles."""
return await self.list_view_areas()
async def list_view_areas(self) -> dict[str, ViewArea]:
"""List all view areas of device."""
discovery_item = self.vapix.api_discovery[self.api_id]
bytes_data = await self.vapix.api_request(
ListViewAreasRequest(discovery_item.version)
)
response = ListViewAreasResponse.decode(bytes_data)
return response.data
async def set_geometry(self, id: int, geometry: Geometry) -> dict[str, ViewArea]:
"""Set geometry of a view area.
Security level: Admin
Method: POST
"""
discovery_item = self.vapix.api_discovery[self.api_id]
bytes_data = await self.vapix.api_request(
SetGeometryRequest(
id=id,
geometry=geometry,
api_version=discovery_item.version,
)
)
response = ListViewAreasResponse.decode(bytes_data)
return response.data
async def reset_geometry(self, id: int) -> dict[str, ViewArea]:
"""Restore geometry of a view area back to default values.
Security level: Admin
Method: POST
"""
discovery_item = self.vapix.api_discovery[self.api_id]
bytes_data = await self.vapix.api_request(
ResetGeometryRequest(id=id, api_version=discovery_item.version)
)
response = ListViewAreasResponse.decode(bytes_data)
return response.data
async def get_supported_versions(self) -> list[str]:
"""List supported API versions."""
bytes_data = await self.vapix.api_request(GetSupportedVersionsRequest())
response = GetSupportedVersionsResponse.decode(bytes_data)
return response.data
async def get_supported_config_versions(self) -> list[str]:
"""List supported configure API versions."""
bytes_data = await self.vapix.api_request(GetSupportedConfigVersionsRequest())
response = GetSupportedVersionsResponse.decode(bytes_data)
return response.data
|
class ViewAreaHandler(ApiHandler[ViewArea]):
'''View areas for Axis devices.'''
async def _api_request(self) -> dict[str, ViewArea]:
'''Get default data of stream profiles.'''
pass
async def list_view_areas(self) -> dict[str, ViewArea]:
'''List all view areas of device.'''
pass
async def set_geometry(self, id: int, geometry: Geometry) -> dict[str, ViewArea]:
'''Set geometry of a view area.
Security level: Admin
Method: POST
'''
pass
async def reset_geometry(self, id: int) -> dict[str, ViewArea]:
'''Restore geometry of a view area back to default values.
Security level: Admin
Method: POST
'''
pass
async def get_supported_versions(self) -> list[str]:
'''List supported API versions.'''
pass
async def get_supported_config_versions(self) -> list[str]:
'''List supported configure API versions.'''
pass
| 7 | 7 | 8 | 0 | 6 | 2 | 1 | 0.35 | 1 | 13 | 9 | 0 | 6 | 0 | 6 | 27 | 59 | 9 | 37 | 21 | 30 | 13 | 27 | 21 | 20 | 1 | 2 | 0 | 6 |
141,388 |
Kane610/axis
|
axis/models/api.py
|
axis.models.api.ApiRequest
|
class ApiRequest:
"""Create API request body."""
method: str = field(init=False)
path: str = field(init=False)
content_type: str = field(init=False)
@property
def content(self) -> bytes | None:
"""Request content."""
return None
@property
def data(self) -> dict[str, str] | None:
"""Request data.
In:
path: /axis-cgi/com/ptz.cgi
data: {"camera": "2", "move": "home"}
Out:
url: /axis-cgi/com/ptz.cgi
payload: {"camera": 2, "move": "home"}
"""
return None
@property
def headers(self) -> dict[str, str]:
"""Request headers."""
return {"Content-Type": self.content_type}
@property
def params(self) -> dict[str, str] | None:
"""Request query parameters.
In:
path: /axis-cgi/io/port.cgi
params: {"action": "1:/"}
Out:
url: /axis-cgi/io/port.cgi?action=4%3A%5C"
"""
return None
|
class ApiRequest:
'''Create API request body.'''
@property
def content(self) -> bytes | None:
'''Request content.'''
pass
@property
def data(self) -> dict[str, str] | None:
'''Request data.
In:
path: /axis-cgi/com/ptz.cgi
data: {"camera": "2", "move": "home"}
Out:
url: /axis-cgi/com/ptz.cgi
payload: {"camera": 2, "move": "home"}
'''
pass
@property
def headers(self) -> dict[str, str]:
'''Request headers.'''
pass
@property
def params(self) -> dict[str, str] | None:
'''Request query parameters.
In:
path: /axis-cgi/io/port.cgi
params: {"action": "1:/"}
Out:
url: /axis-cgi/io/port.cgi?action=4%3A%5C"
'''
pass
| 9 | 5 | 7 | 1 | 2 | 4 | 1 | 1.13 | 0 | 3 | 0 | 60 | 4 | 0 | 4 | 4 | 41 | 7 | 16 | 12 | 7 | 18 | 12 | 8 | 7 | 1 | 0 | 0 | 4 |
141,389 |
Kane610/axis
|
axis/models/api.py
|
axis.models.api.ApiResponse
|
class ApiResponse(ApiResponseSupportDecode, Generic[ApiDataT]):
"""Response from API request.
Class with generic can't be used in a TypeVar("X", bound=class) statement.
"""
data: ApiDataT
|
class ApiResponse(ApiResponseSupportDecode, Generic[ApiDataT]):
'''Response from API request.
Class with generic can't be used in a TypeVar("X", bound=class) statement.
'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1.5 | 2 | 0 | 0 | 36 | 0 | 0 | 0 | 23 | 7 | 2 | 2 | 1 | 1 | 3 | 2 | 1 | 1 | 0 | 5 | 0 | 0 |
141,390 |
Kane610/axis
|
axis/models/applications/fence_guard.py
|
axis.models.applications.fence_guard.GetConfigurationResponse
|
class GetConfigurationResponse(ApiResponse[Configuration]):
"""Response object for Fence guard configuration."""
api_version: str
context: str
method: str
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare Fence guard configuration response data."""
data: GetConfigurationResponseT = orjson.loads(bytes_data)
return cls(
api_version=data["apiVersion"],
context=data["context"],
method=data["method"],
data=Configuration.decode(data["data"]),
)
|
class GetConfigurationResponse(ApiResponse[Configuration]):
'''Response object for Fence guard configuration.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare Fence guard configuration response data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.15 | 1 | 3 | 2 | 0 | 0 | 0 | 1 | 24 | 17 | 2 | 13 | 4 | 10 | 2 | 7 | 3 | 5 | 1 | 6 | 0 | 1 |
141,391 |
Kane610/axis
|
axis/models/event_instance.py
|
axis.models.event_instance.ListEventInstancesRequest
|
class ListEventInstancesRequest(ApiRequest):
"""Request object for listing installed applications."""
method = "post"
path = "/vapix/services"
@property
def content(self) -> bytes:
"""Request content."""
return (
b'<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope">'
b'<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
b'xmlns:xsd="http://www.w3.org/2001/XMLSchema">'
b'<GetEventInstances xmlns="http://www.axis.com/vapix/ws/event1"/>'
b"</s:Body>"
b"</s:Envelope>"
)
@property
def headers(self) -> dict[str, str]:
"""Request headers."""
return {
"Content-Type": "application/soap+xml",
"SOAPAction": "http://www.axis.com/vapix/ws/event1/GetEventInstances",
}
|
class ListEventInstancesRequest(ApiRequest):
'''Request object for listing installed applications.'''
@property
def content(self) -> bytes:
'''Request content.'''
pass
@property
def headers(self) -> dict[str, str]:
'''Request headers.'''
pass
| 5 | 3 | 8 | 0 | 7 | 1 | 1 | 0.16 | 1 | 3 | 0 | 0 | 2 | 0 | 2 | 6 | 25 | 3 | 19 | 7 | 14 | 3 | 7 | 5 | 4 | 1 | 1 | 0 | 2 |
141,392 |
Kane610/axis
|
axis/models/applications/loitering_guard.py
|
axis.models.applications.loitering_guard.Configuration
|
class Configuration(ApiItem):
"""Loitering guard configuration."""
cameras: list[ConfigurationCameraDataT]
"""Cameras."""
profiles: dict[str, ProfileConfiguration]
"""Profiles"""
configuration_status: int
@classmethod
def decode(cls, data: ConfigurationDataT) -> Self:
"""Decode dict to class object."""
return cls(
id="loitering guard",
cameras=data["cameras"],
profiles=ProfileConfiguration.decode_to_dict(data["profiles"]),
configuration_status=data["configurationStatus"],
)
|
class Configuration(ApiItem):
'''Loitering guard configuration.'''
@classmethod
def decode(cls, data: ConfigurationDataT) -> Self:
'''Decode dict to class object.'''
pass
| 3 | 2 | 8 | 0 | 7 | 1 | 1 | 0.33 | 1 | 2 | 2 | 0 | 0 | 0 | 1 | 24 | 20 | 4 | 12 | 3 | 9 | 4 | 6 | 2 | 4 | 1 | 5 | 0 | 1 |
141,393 |
Kane610/axis
|
axis/models/applications/loitering_guard.py
|
axis.models.applications.loitering_guard.GetConfigurationResponse
|
class GetConfigurationResponse(ApiResponse[Configuration]):
"""Response object for Loitering guard configuration."""
api_version: str
context: str
method: str
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare Loitering guard configuration response data."""
data: GetConfigurationResponseT = orjson.loads(bytes_data)
return cls(
api_version=data["apiVersion"],
context=data["context"],
method=data["method"],
data=Configuration.decode(data["data"]),
)
|
class GetConfigurationResponse(ApiResponse[Configuration]):
'''Response object for Loitering guard configuration.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare Loitering guard configuration response data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.15 | 1 | 3 | 2 | 0 | 0 | 0 | 1 | 24 | 17 | 2 | 13 | 4 | 10 | 2 | 7 | 3 | 5 | 1 | 6 | 0 | 1 |
141,394 |
Kane610/axis
|
axis/models/applications/vmd4.py
|
axis.models.applications.vmd4.GetConfigurationResponse
|
class GetConfigurationResponse(ApiResponse[Configuration]):
"""Response object for VMD4 configuration."""
api_version: str
context: str
method: str
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare VMD4 configuration response data."""
data: GetConfigurationResponseT = orjson.loads(bytes_data)
return cls(
api_version=data["apiVersion"],
context=data["context"],
method=data["method"],
data=Configuration.decode(data["data"]),
)
|
class GetConfigurationResponse(ApiResponse[Configuration]):
'''Response object for VMD4 configuration.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare VMD4 configuration response data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.15 | 1 | 3 | 2 | 0 | 0 | 0 | 1 | 24 | 17 | 2 | 13 | 4 | 10 | 2 | 7 | 3 | 5 | 1 | 6 | 0 | 1 |
141,395 |
Kane610/axis
|
axis/models/applications/vmd4.py
|
axis.models.applications.vmd4.GetConfigurationResponseT
|
class GetConfigurationResponseT(TypedDict):
"""Get configuration response."""
apiVersion: str
context: str
method: str
data: ConfigurationDataT
|
class GetConfigurationResponseT(TypedDict):
'''Get configuration response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 1 | 5 | 1 | 4 | 1 | 5 | 1 | 4 | 0 | 1 | 0 | 0 |
141,396 |
Kane610/axis
|
axis/models/applications/vmd4.py
|
axis.models.applications.vmd4.ProfileConfiguration
|
class ProfileConfiguration(ApiItem):
"""Profile configuration."""
camera: int
"""Camera ID."""
filters: list[dict[str, Any]]
"""Array of exclude filters."""
name: str
"""Nice name of profile."""
presets: list[int]
"""For mechanical PTZ cameras, each profile can be connected to one preset.
If a preset is added, the profile will only be active when the camera is at
the given preset. If this parameter is omitted or the profile is not connected
to any preset it will always be active.
"""
triggers: list[dict[str, Any]]
"""Array of triggers."""
@classmethod
def decode(cls, data: ProfileConfigurationDataT) -> Self:
"""Decode dict to class object."""
return cls(
id=str(data["uid"]),
camera=data["camera"],
filters=data["filters"],
name=data["name"],
presets=data.get("presets", []),
triggers=data["triggers"],
)
|
class ProfileConfiguration(ApiItem):
'''Profile configuration.'''
@classmethod
def decode(cls, data: ProfileConfigurationDataT) -> Self:
'''Decode dict to class object.'''
pass
| 3 | 2 | 10 | 0 | 9 | 1 | 1 | 0.69 | 1 | 2 | 1 | 0 | 0 | 0 | 1 | 24 | 34 | 7 | 16 | 3 | 13 | 11 | 8 | 2 | 6 | 1 | 5 | 0 | 1 |
141,397 |
Kane610/axis
|
axis/models/applications/vmd4.py
|
axis.models.applications.vmd4.ProfileConfigurationDataT
|
class ProfileConfigurationDataT(TypedDict):
"""Profile configuration data from response."""
camera: int
filters: list[dict[str, Any]]
name: str
perspective: list[dict[str, Any]] | None
presets: NotRequired[list[int]]
triggers: list[dict[str, Any]]
uid: int
|
class ProfileConfigurationDataT(TypedDict):
'''Profile configuration data from response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.13 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 1 | 8 | 1 | 7 | 1 | 8 | 1 | 7 | 0 | 1 | 0 | 0 |
141,398 |
Kane610/axis
|
axis/models/basic_device_info.py
|
axis.models.basic_device_info.DeviceInformation
|
class DeviceInformation(ApiItem):
"""API Discovery item."""
architecture: str
brand: str
build_date: str
firmware_version: str
hardware_id: str
product_full_name: str
product_number: str
product_short_name: str
product_type: str
product_variant: str
serial_number: str
soc: str
soc_serial_number: str
web_url: str
@classmethod
def decode(cls, data: DeviceInformationDescriptionT) -> Self:
"""Decode dict to class object."""
return cls(
id="0",
architecture=data["Architecture"],
brand=data["Brand"],
build_date=data["BuildDate"],
firmware_version=data["Version"],
hardware_id=data["HardwareID"],
product_full_name=data["ProdFullName"],
product_number=data["ProdNbr"],
product_short_name=data["ProdShortName"],
product_type=data["ProdType"],
product_variant=data["ProdVariant"],
serial_number=data["SerialNumber"],
soc=data["Soc"],
soc_serial_number=data["SocSerialNumber"],
web_url=data["WebURL"],
)
|
class DeviceInformation(ApiItem):
'''API Discovery item.'''
@classmethod
def decode(cls, data: DeviceInformationDescriptionT) -> Self:
'''Decode dict to class object.'''
pass
| 3 | 2 | 19 | 0 | 18 | 1 | 1 | 0.06 | 1 | 1 | 1 | 0 | 0 | 0 | 1 | 24 | 38 | 2 | 34 | 3 | 31 | 2 | 17 | 2 | 15 | 1 | 5 | 0 | 1 |
141,399 |
Kane610/axis
|
axis/models/basic_device_info.py
|
axis.models.basic_device_info.DeviceInformationDescriptionT
|
class DeviceInformationDescriptionT(TypedDict):
"""API description representation."""
Architecture: str
Brand: str
BuildDate: str
HardwareID: str
ProdFullName: str
ProdNbr: str
ProdShortName: str
ProdType: str
ProdVariant: str
SerialNumber: str
Soc: str
SocSerialNumber: str
Version: str
WebURL: str
|
class DeviceInformationDescriptionT(TypedDict):
'''API description representation.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.07 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 17 | 1 | 15 | 1 | 14 | 1 | 15 | 1 | 14 | 0 | 1 | 0 | 0 |
141,400 |
Kane610/axis
|
axis/models/basic_device_info.py
|
axis.models.basic_device_info.GetAllPropertiesRequest
|
class GetAllPropertiesRequest(ApiRequest):
"""Request object for basic device info."""
method = "post"
path = "/axis-cgi/basicdeviceinfo.cgi"
content_type = "application/json"
error_codes = error_codes
api_version: str = API_VERSION
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"apiVersion": self.api_version,
"context": self.context,
"method": "getAllProperties",
}
)
|
class GetAllPropertiesRequest(ApiRequest):
'''Request object for basic device info.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.13 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 21 | 3 | 16 | 9 | 13 | 2 | 9 | 8 | 7 | 1 | 1 | 0 | 1 |
141,401 |
Kane610/axis
|
axis/models/applications/vmd4.py
|
axis.models.applications.vmd4.GetConfigurationRequest
|
class GetConfigurationRequest(ApiRequest):
"""Request object for listing VMD4 configuration."""
method = "post"
path = "/local/vmd/control.cgi"
content_type = "application/json"
api_version: str = API_VERSION
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"apiVersion": self.api_version,
"context": self.context,
"method": "getConfiguration",
}
)
|
class GetConfigurationRequest(ApiRequest):
'''Request object for listing VMD4 configuration.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.13 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 20 | 3 | 15 | 8 | 12 | 2 | 8 | 7 | 6 | 1 | 1 | 0 | 1 |
141,402 |
Kane610/axis
|
axis/models/basic_device_info.py
|
axis.models.basic_device_info.GetAllPropertiesResponse
|
class GetAllPropertiesResponse(ApiResponse[DeviceInformation]):
"""Response object for basic device info."""
api_version: str
context: str
method: str
data: DeviceInformation
# error: ErrorDataT | None = None
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare API description dictionary."""
data: GetAllPropertiesResponseT = orjson.loads(bytes_data)
return cls(
api_version=data["apiVersion"],
context=data["context"],
method=data.get("method", ""),
data=DeviceInformation.decode(data["data"]["propertyList"]),
)
|
class GetAllPropertiesResponse(ApiResponse[DeviceInformation]):
'''Response object for basic device info.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare API description dictionary.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.21 | 1 | 3 | 2 | 0 | 0 | 0 | 1 | 24 | 19 | 2 | 14 | 4 | 11 | 3 | 8 | 3 | 6 | 1 | 6 | 0 | 1 |
141,403 |
Kane610/axis
|
axis/models/basic_device_info.py
|
axis.models.basic_device_info.GetSupportedVersionsRequest
|
class GetSupportedVersionsRequest(ApiRequest):
"""Request object for listing supported API versions."""
method = "post"
path = "/axis-cgi/basicdeviceinfo.cgi"
content_type = "application/json"
error_codes = error_codes
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"context": self.context,
"method": "getSupportedVersions",
}
)
|
class GetSupportedVersionsRequest(ApiRequest):
'''Request object for listing supported API versions.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 8 | 0 | 7 | 1 | 1 | 0.14 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 19 | 3 | 14 | 8 | 11 | 2 | 8 | 7 | 6 | 1 | 1 | 0 | 1 |
141,404 |
Kane610/axis
|
axis/models/basic_device_info.py
|
axis.models.basic_device_info.PropertiesDataT
|
class PropertiesDataT(TypedDict):
"""List of API description data."""
propertyList: DeviceInformationDescriptionT
|
class PropertiesDataT(TypedDict):
'''List of API description data.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,405 |
Kane610/axis
|
axis/models/configuration.py
|
axis.models.configuration.Configuration
|
class Configuration:
"""Device configuration."""
session: AsyncClient
host: str
_: KW_ONLY
username: str
password: str
port: int = 80
web_proto: str = "http"
verify_ssl: bool = False
@property
def url(self) -> str:
"""Represent device base url."""
return f"{self.web_proto}://{self.host}:{self.port}"
|
class Configuration:
'''Device configuration.'''
@property
def url(self) -> str:
'''Represent device base url.'''
pass
| 3 | 2 | 3 | 0 | 2 | 1 | 1 | 0.17 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 1 | 16 | 2 | 12 | 6 | 9 | 2 | 11 | 5 | 9 | 1 | 0 | 0 | 1 |
141,406 |
Kane610/axis
|
axis/models/event.py
|
axis.models.event.Event
|
class Event:
"""Event data from Axis device."""
data: dict[str, Any]
group: EventGroup
id: str
is_tripped: bool
operation: EventOperation
source: str
state: str
topic: str
topic_base: EventTopic
@classmethod
def decode(cls, data: bytes | dict[str, Any]) -> Self:
"""Decode data to an event object."""
if isinstance(data, dict):
return cls._decode_from_dict(data)
return cls._decode_from_bytes(data)
@classmethod
def _decode_from_dict(cls, data: dict[str, Any]) -> Self:
"""Create event instance from dict."""
operation = EventOperation(data.get(EVENT_OPERATION, ""))
topic = data.get(EVENT_TOPIC, "")
source = data.get(EVENT_SOURCE, "")
source_idx = data.get(EVENT_SOURCE_IDX, "")
value = data.get(EVENT_VALUE, "")
if (topic_base := EventTopic(topic)) == EventTopic.UNKNOWN:
_topic_base, _, _source_idx = topic.rpartition("/")
topic_base = EventTopic(_topic_base)
if source_idx == "":
source_idx = _source_idx
if source_idx == "-1":
source_idx = "ANY" if source != "port" else ""
return cls(
data=data,
group=TOPIC_TO_GROUP.get(topic_base, EventGroup.NONE),
id=source_idx,
is_tripped=value == TOPIC_TO_STATE.get(topic_base, "1"),
operation=operation,
source=source,
state=value,
topic=topic,
topic_base=topic_base,
)
@classmethod
def _decode_from_bytes(cls, data: bytes) -> Self:
"""Parse metadata xml."""
raw = xmltodict.parse(
data,
# attr_prefix="",
process_namespaces=True,
namespaces=XML_NAMESPACES,
)
if raw.get("MetadataStream") is None:
return cls._decode_from_dict({})
topic = traverse(raw, TOPIC)
# timestamp = traverse(raw, TIMESTAMP)
operation = traverse(raw, OPERATION)
source = source_idx = ""
if match := traverse(raw, SOURCE):
source, source_idx = extract_name_value(match)
data_type = data_value = ""
if match := traverse(raw, DATA):
data_type, data_value = extract_name_value(match, "active")
return cls._decode_from_dict(
{
EVENT_OPERATION: operation,
EVENT_TOPIC: topic,
EVENT_SOURCE: source,
EVENT_SOURCE_IDX: source_idx,
EVENT_TYPE: data_type,
EVENT_VALUE: data_value,
}
)
|
class Event:
'''Event data from Axis device.'''
@classmethod
def decode(cls, data: bytes | dict[str, Any]) -> Self:
'''Decode data to an event object.'''
pass
@classmethod
def _decode_from_dict(cls, data: dict[str, Any]) -> Self:
'''Create event instance from dict.'''
pass
@classmethod
def _decode_from_bytes(cls, data: bytes) -> Self:
'''Parse metadata xml.'''
pass
| 7 | 4 | 22 | 3 | 18 | 2 | 4 | 0.09 | 0 | 7 | 3 | 0 | 0 | 0 | 3 | 3 | 85 | 12 | 67 | 20 | 60 | 6 | 41 | 15 | 37 | 5 | 0 | 2 | 11 |
141,407 |
Kane610/axis
|
axis/models/event.py
|
axis.models.event.EventGroup
|
class EventGroup(enum.StrEnum):
"""Logical grouping of events."""
INPUT = "input"
LIGHT = "light"
MOTION = "motion"
OUTPUT = "output"
PTZ = "ptz"
SOUND = "sound"
NONE = "none"
|
class EventGroup(enum.StrEnum):
'''Logical grouping of events.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.13 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 68 | 10 | 1 | 8 | 8 | 7 | 1 | 8 | 8 | 7 | 0 | 3 | 0 | 0 |
141,408 |
Kane610/axis
|
axis/models/event.py
|
axis.models.event.EventOperation
|
class EventOperation(enum.StrEnum):
"""Possible operations of an event."""
INITIALIZED = "Initialized"
CHANGED = "Changed"
DELETED = "Deleted"
UNKNOWN = "Unknown"
@classmethod
def _missing_(cls, value: object) -> "EventOperation":
"""Set default enum member if an unknown value is provided."""
if LOGGER.isEnabledFor(logging.DEBUG):
LOGGER.warning("Unsupported operation %s", value)
return EventOperation.UNKNOWN
|
class EventOperation(enum.StrEnum):
'''Possible operations of an event.'''
@classmethod
def _missing_(cls, value: object) -> "EventOperation":
'''Set default enum member if an unknown value is provided.'''
pass
| 3 | 2 | 5 | 0 | 4 | 1 | 2 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 69 | 14 | 2 | 10 | 7 | 7 | 2 | 9 | 6 | 7 | 2 | 3 | 1 | 2 |
141,409 |
Kane610/axis
|
axis/models/event.py
|
axis.models.event.EventTopic
|
class EventTopic(enum.StrEnum):
"""Supported event topics."""
DAY_NIGHT_VISION = "tns1:VideoSource/tnsaxis:DayNightVision"
FENCE_GUARD = "tnsaxis:CameraApplicationPlatform/FenceGuard"
LIGHT_STATUS = "tns1:Device/tnsaxis:Light/Status"
LOITERING_GUARD = "tnsaxis:CameraApplicationPlatform/LoiteringGuard"
MOTION_DETECTION = "tns1:VideoAnalytics/tnsaxis:MotionDetection"
MOTION_DETECTION_3 = "tns1:RuleEngine/tnsaxis:VMD3/vmd3_video_1"
MOTION_DETECTION_4 = "tnsaxis:CameraApplicationPlatform/VMD"
MOTION_GUARD = "tnsaxis:CameraApplicationPlatform/MotionGuard"
OBJECT_ANALYTICS = "tnsaxis:CameraApplicationPlatform/ObjectAnalytics"
PIR = "tns1:Device/tnsaxis:Sensor/PIR"
PORT_INPUT = "tns1:Device/tnsaxis:IO/Port"
PORT_SUPERVISED_INPUT = "tns1:Device/tnsaxis:IO/SupervisedPort"
PTZ_IS_MOVING = "tns1:PTZController/tnsaxis:Move"
PTZ_ON_PRESET = "tns1:PTZController/tnsaxis:PTZPresets"
RELAY = "tns1:Device/Trigger/Relay"
SOUND_TRIGGER_LEVEL = "tns1:AudioSource/tnsaxis:TriggerLevel"
UNKNOWN = "unknown"
@classmethod
def _missing_(cls, value: object) -> "EventTopic":
"""Set default enum member if an unknown value is provided."""
if LOGGER.isEnabledFor(logging.DEBUG):
LOGGER.warning("Unsupported topic %s", value)
return EventTopic.UNKNOWN
|
class EventTopic(enum.StrEnum):
'''Supported event topics.'''
@classmethod
def _missing_(cls, value: object) -> "EventTopic":
'''Set default enum member if an unknown value is provided.'''
pass
| 3 | 2 | 5 | 0 | 4 | 1 | 2 | 0.09 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 69 | 27 | 2 | 23 | 20 | 20 | 2 | 22 | 19 | 20 | 2 | 3 | 1 | 2 |
141,410 |
Kane610/axis
|
axis/models/basic_device_info.py
|
axis.models.basic_device_info.GetAllPropertiesResponseT
|
class GetAllPropertiesResponseT(TypedDict):
"""ListApis response."""
apiVersion: str
context: str
method: str
data: PropertiesDataT
error: NotRequired[ErrorDataT]
|
class GetAllPropertiesResponseT(TypedDict):
'''ListApis response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 6 | 1 | 5 | 1 | 6 | 1 | 5 | 0 | 1 | 0 | 0 |
141,411 |
Kane610/axis
|
axis/models/applications/vmd4.py
|
axis.models.applications.vmd4.ConfigurationDataT
|
class ConfigurationDataT(TypedDict):
"""Configuration data from response."""
cameras: list[CameraConfigurationDataT]
profiles: list[ProfileConfigurationDataT]
configurationStatus: int
|
class ConfigurationDataT(TypedDict):
'''Configuration data from response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 1 | 4 | 1 | 3 | 1 | 4 | 1 | 3 | 0 | 1 | 0 | 0 |
141,412 |
Kane610/axis
|
axis/models/applications/vmd4.py
|
axis.models.applications.vmd4.Configuration
|
class Configuration(ApiItem):
"""VMD4 configuration."""
cameras: list[CameraConfigurationDataT]
"""Cameras."""
profiles: dict[str, ProfileConfiguration]
"""Profiles"""
configuration_status: int
@classmethod
def decode(cls, data: ConfigurationDataT) -> Self:
"""Decode dict to class object."""
return cls(
id="vmd4",
cameras=data["cameras"],
profiles=ProfileConfiguration.decode_to_dict(data["profiles"]),
configuration_status=data["configurationStatus"],
)
|
class Configuration(ApiItem):
'''VMD4 configuration.'''
@classmethod
def decode(cls, data: ConfigurationDataT) -> Self:
'''Decode dict to class object.'''
pass
| 3 | 2 | 8 | 0 | 7 | 1 | 1 | 0.33 | 1 | 2 | 2 | 0 | 0 | 0 | 1 | 24 | 20 | 4 | 12 | 3 | 9 | 4 | 6 | 2 | 4 | 1 | 5 | 0 | 1 |
141,413 |
Kane610/axis
|
axis/models/applications/vmd4.py
|
axis.models.applications.vmd4.CameraConfigurationDataT
|
class CameraConfigurationDataT(TypedDict):
"""Camera configuration data from response."""
active: bool
id: int
rotation: int
|
class CameraConfigurationDataT(TypedDict):
'''Camera configuration data from response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 1 | 4 | 1 | 3 | 1 | 4 | 1 | 3 | 0 | 1 | 0 | 0 |
141,414 |
Kane610/axis
|
axis/models/applications/motion_guard.py
|
axis.models.applications.motion_guard.Configuration
|
class Configuration(ApiItem):
"""Motion guard configuration."""
cameras: list[ConfigurationCameraDataT]
"""Cameras."""
profiles: dict[str, ProfileConfiguration]
"""Profiles"""
configuration_status: int
@classmethod
def decode(cls, data: ConfigurationDataT) -> Self:
"""Decode dict to class object."""
return cls(
id="motion guard",
cameras=data["cameras"],
profiles=ProfileConfiguration.decode_to_dict(data["profiles"]),
configuration_status=data["configurationStatus"],
)
|
class Configuration(ApiItem):
'''Motion guard configuration.'''
@classmethod
def decode(cls, data: ConfigurationDataT) -> Self:
'''Decode dict to class object.'''
pass
| 3 | 2 | 8 | 0 | 7 | 1 | 1 | 0.33 | 1 | 2 | 2 | 0 | 0 | 0 | 1 | 24 | 20 | 4 | 12 | 3 | 9 | 4 | 6 | 2 | 4 | 1 | 5 | 0 | 1 |
141,415 |
Kane610/axis
|
axis/models/applications/motion_guard.py
|
axis.models.applications.motion_guard.ConfigurationCameraDataT
|
class ConfigurationCameraDataT(TypedDict):
"""Camera configuration data from response."""
active: bool
id: int
rotation: int
|
class ConfigurationCameraDataT(TypedDict):
'''Camera configuration data from response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 1 | 4 | 1 | 3 | 1 | 4 | 1 | 3 | 0 | 1 | 0 | 0 |
141,416 |
Kane610/axis
|
axis/models/applications/motion_guard.py
|
axis.models.applications.motion_guard.ConfigurationDataT
|
class ConfigurationDataT(TypedDict):
"""Configuration data from response."""
cameras: list[ConfigurationCameraDataT]
profiles: list[ConfigurationProfileDataT]
configurationStatus: int
|
class ConfigurationDataT(TypedDict):
'''Configuration data from response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 1 | 4 | 1 | 3 | 1 | 4 | 1 | 3 | 0 | 1 | 0 | 0 |
141,417 |
Kane610/axis
|
axis/models/applications/motion_guard.py
|
axis.models.applications.motion_guard.ConfigurationProfileDataT
|
class ConfigurationProfileDataT(TypedDict):
"""Profile configuration data from response."""
alarmOverlayEnabled: bool
camera: int
filters: list[dict[str, Any]]
name: str
perspective: NotRequired[list[dict[str, Any]]]
presets: NotRequired[list[int]]
triggers: list[dict[str, Any]]
uid: int
|
class ConfigurationProfileDataT(TypedDict):
'''Profile configuration data from response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.11 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 11 | 1 | 9 | 1 | 8 | 1 | 9 | 1 | 8 | 0 | 1 | 0 | 0 |
141,418 |
Kane610/axis
|
axis/models/mqtt.py
|
axis.models.mqtt.ServerT
|
class ServerT(TypedDict):
"""Represent a server object."""
host: str
protocol: NotRequired[Literal["ssl", "tcp", "ws", "wss"]]
alpnProtocol: NotRequired[str]
basepath: NotRequired[str]
port: NotRequired[int]
|
class ServerT(TypedDict):
'''Represent a server object.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 6 | 1 | 5 | 1 | 6 | 1 | 5 | 0 | 1 | 0 | 0 |
141,419 |
Kane610/axis
|
axis/models/applications/motion_guard.py
|
axis.models.applications.motion_guard.GetConfigurationResponse
|
class GetConfigurationResponse(ApiResponse[Configuration]):
"""Response object for Motion guard configuration."""
api_version: str
context: str
method: str
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare Motion guard configuration response data."""
data: GetConfigurationResponseT = orjson.loads(bytes_data)
return cls(
api_version=data["apiVersion"],
context=data["context"],
method=data["method"],
data=Configuration.decode(data["data"]),
)
|
class GetConfigurationResponse(ApiResponse[Configuration]):
'''Response object for Motion guard configuration.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare Motion guard configuration response data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.15 | 1 | 3 | 2 | 0 | 0 | 0 | 1 | 24 | 17 | 2 | 13 | 4 | 10 | 2 | 7 | 3 | 5 | 1 | 6 | 0 | 1 |
141,420 |
Kane610/axis
|
axis/models/applications/motion_guard.py
|
axis.models.applications.motion_guard.ProfileConfiguration
|
class ProfileConfiguration(ApiItem):
"""Profile configuration."""
camera: int
"""Camera ID."""
filters: list[dict[str, Any]]
"""Array of exclude filters."""
name: str
"""Nice name of profile."""
perspective: list[dict[str, Any]]
"""Perspective for improve triggers based on heights."""
presets: list[int]
"""For mechanical PTZ cameras, each profile can be connected to one preset.
If a preset is added, the profile will only be active when the camera is at
the given preset. If this parameter is omitted or the profile is not connected
to any preset it will always be active.
"""
triggers: list[dict[str, Any]]
"""Array of triggers."""
@classmethod
def decode(cls, data: Any) -> Self:
"""Decode dict to class object."""
return cls(
id=str(data["uid"]),
camera=data["camera"],
filters=data["filters"],
name=data["name"],
perspective=data.get("perspective", []),
presets=data.get("presets", []),
triggers=data["triggers"],
)
|
class ProfileConfiguration(ApiItem):
'''Profile configuration.'''
@classmethod
def decode(cls, data: Any) -> Self:
'''Decode dict to class object.'''
pass
| 3 | 2 | 11 | 0 | 10 | 1 | 1 | 0.67 | 1 | 2 | 0 | 0 | 0 | 0 | 1 | 24 | 38 | 8 | 18 | 3 | 15 | 12 | 9 | 2 | 7 | 1 | 5 | 0 | 1 |
141,421 |
Kane610/axis
|
axis/models/applications/object_analytics.py
|
axis.models.applications.object_analytics.Configuration
|
class Configuration(ApiItem):
"""Object analytics configuration."""
devices: list[ConfigurationDeviceDataT]
"""Container for the supported video devices."""
metadata_overlay: list[ConfigurationMetadataOverlayDataT]
"""Container for the metadata overlay options."""
perspectives: list[ConfigurationPerspectiveDataT]
"""Container for the perspective data."""
scenarios: dict[str, ScenarioConfiguration]
"""Container for the scenario data."""
@classmethod
def decode(cls, data: ConfigurationDataT) -> Self:
"""Decode dict to class object."""
return cls(
id="object analytics",
devices=data["devices"],
metadata_overlay=data["metadataOverlay"],
perspectives=data.get("perspectives", []),
scenarios=ScenarioConfiguration.decode_to_dict(data["scenarios"]),
)
|
class Configuration(ApiItem):
'''Object analytics configuration.'''
@classmethod
def decode(cls, data: ConfigurationDataT) -> Self:
'''Decode dict to class object.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.43 | 1 | 2 | 2 | 0 | 0 | 0 | 1 | 24 | 25 | 5 | 14 | 3 | 11 | 6 | 7 | 2 | 5 | 1 | 5 | 0 | 1 |
141,422 |
Kane610/axis
|
axis/models/applications/object_analytics.py
|
axis.models.applications.object_analytics.ConfigurationDataT
|
class ConfigurationDataT(TypedDict):
"""Configuration data from response."""
devices: list[ConfigurationDeviceDataT]
metadataOverlay: list[ConfigurationMetadataOverlayDataT]
perspectives: NotRequired[list[ConfigurationPerspectiveDataT]]
scenarios: list[ConfigurationScenarioDataT]
|
class ConfigurationDataT(TypedDict):
'''Configuration data from response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 1 | 5 | 1 | 4 | 1 | 5 | 1 | 4 | 0 | 1 | 0 | 0 |
141,423 |
Kane610/axis
|
axis/models/applications/object_analytics.py
|
axis.models.applications.object_analytics.ConfigurationDeviceDataT
|
class ConfigurationDeviceDataT(TypedDict):
"""Device configuration data from response."""
id: int
type: Literal["camera"]
rotation: int
isActive: bool
|
class ConfigurationDeviceDataT(TypedDict):
'''Device configuration data from response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 1 | 5 | 1 | 4 | 1 | 5 | 1 | 4 | 0 | 1 | 0 | 0 |
141,424 |
Kane610/axis
|
axis/models/applications/object_analytics.py
|
axis.models.applications.object_analytics.ConfigurationMetadataOverlayDataT
|
class ConfigurationMetadataOverlayDataT(TypedDict):
"""Metadata overlay configuration data from response."""
id: int
drawOnAllResolutions: bool
resolutions: list[str]
|
class ConfigurationMetadataOverlayDataT(TypedDict):
'''Metadata overlay configuration data from response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 1 | 4 | 1 | 3 | 1 | 4 | 1 | 3 | 0 | 1 | 0 | 0 |
141,425 |
Kane610/axis
|
axis/models/applications/object_analytics.py
|
axis.models.applications.object_analytics.ConfigurationPerspectiveDataT
|
class ConfigurationPerspectiveDataT(TypedDict):
"""Perspective configuration data from response."""
id: int
bars: list[dict[str, Any]]
|
class ConfigurationPerspectiveDataT(TypedDict):
'''Perspective configuration data from response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 1 | 3 | 1 | 2 | 1 | 3 | 1 | 2 | 0 | 1 | 0 | 0 |
141,426 |
Kane610/axis
|
axis/models/applications/object_analytics.py
|
axis.models.applications.object_analytics.ConfigurationScenarioDataT
|
class ConfigurationScenarioDataT(TypedDict):
"""Scenario configuration data from response."""
id: int
name: str
type: Literal["crosslinecounting", "fence", "motion", "occupancyInArea"]
metadataOverlay: int
alarmRate: str
devices: list[dict[str, Any]]
filters: list[dict[str, Any]]
objectClassifications: NotRequired[list[dict[str, str]]]
perspectives: NotRequired[list[int]]
presets: NotRequired[list[int]]
triggers: list[dict[str, Any]]
|
class ConfigurationScenarioDataT(TypedDict):
'''Scenario configuration data from response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.08 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 14 | 1 | 12 | 1 | 11 | 1 | 12 | 1 | 11 | 0 | 1 | 0 | 0 |
141,427 |
Kane610/axis
|
axis/models/applications/object_analytics.py
|
axis.models.applications.object_analytics.GetConfigurationRequest
|
class GetConfigurationRequest(ApiRequest):
"""Request object for listing Object analytics configuration."""
method = "post"
path = "/local/objectanalytics/control.cgi"
content_type = "application/json"
api_version: str = API_VERSION
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"apiVersion": self.api_version,
"context": self.context,
"method": "getConfiguration",
"params": {}, # Early version of AOA (v1.0-20) requires this
}
)
|
class GetConfigurationRequest(ApiRequest):
'''Request object for listing Object analytics configuration.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 10 | 0 | 9 | 2 | 1 | 0.19 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 21 | 3 | 16 | 8 | 13 | 3 | 8 | 7 | 6 | 1 | 1 | 0 | 1 |
141,428 |
Kane610/axis
|
axis/models/applications/object_analytics.py
|
axis.models.applications.object_analytics.GetConfigurationResponse
|
class GetConfigurationResponse(ApiResponse[Configuration]):
"""Response object for Object analytics configuration."""
api_version: str
context: str
method: str
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare Object analytics configuration response data."""
data: GetConfigurationResponseT = orjson.loads(bytes_data)
return cls(
api_version=data["apiVersion"],
context=data["context"],
method=data["method"],
data=Configuration.decode(data["data"]),
)
|
class GetConfigurationResponse(ApiResponse[Configuration]):
'''Response object for Object analytics configuration.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare Object analytics configuration response data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.15 | 1 | 3 | 2 | 0 | 0 | 0 | 1 | 24 | 17 | 2 | 13 | 4 | 10 | 2 | 7 | 3 | 5 | 1 | 6 | 0 | 1 |
141,429 |
Kane610/axis
|
axis/models/applications/object_analytics.py
|
axis.models.applications.object_analytics.ScenarioConfiguration
|
class ScenarioConfiguration(ApiItem):
"""Profile configuration."""
devices: list[dict[str, int]]
"""Lists the devices that the scenario should be applied to."""
filters: list[dict[str, Any]]
"""Array of exclude filters."""
name: str
"""Nice name of scenario."""
object_classifications: list[dict[str, str]]
"""Identifies the object type and additional subtype."""
perspectives: list[int]
"""A list of perspective IDs used in the scenario."""
presets: list[int]
"""For mechanical PTZ cameras, each profile can be connected to one preset.
If a preset is added, the profile will only be active when the camera is at
the given preset. If this parameter is omitted or the profile is not connected
to any preset it will always be active.
-2 - Tracking is always enabled, except when camera is moving.
-1 - Tracking is done on all preset positions.
No tracking is done if the PTZ device is not set to a preset.
1 - Tracking on the home position of the PTZ device.
2... - Tracking on specific presets only.
"""
triggers: list[dict[str, Any]]
"""Array of triggers."""
type: ScenarioType
"""Possible scenario types."""
@classmethod
def decode(cls, data: ConfigurationScenarioDataT) -> Self:
"""Decode dict to class object."""
return cls(
id=str(data["id"]),
devices=data["devices"],
filters=data.get("filters", []),
name=data["name"],
object_classifications=data.get("objectClassifications", []),
perspectives=data.get("perspectives", []),
presets=data.get("presets", []),
triggers=data["triggers"],
type=ScenarioType(data["type"]),
)
|
class ScenarioConfiguration(ApiItem):
'''Profile configuration.'''
@classmethod
def decode(cls, data: ConfigurationScenarioDataT) -> Self:
'''Decode dict to class object.'''
pass
| 3 | 2 | 13 | 0 | 12 | 1 | 1 | 0.86 | 1 | 3 | 2 | 0 | 0 | 0 | 1 | 24 | 52 | 11 | 22 | 3 | 19 | 19 | 11 | 2 | 9 | 1 | 5 | 0 | 1 |
141,430 |
Kane610/axis
|
axis/models/applications/object_analytics.py
|
axis.models.applications.object_analytics.ScenarioType
|
class ScenarioType(enum.StrEnum):
"""Scenario types."""
CROSS_LINE_COUNTING = "crosslinecounting"
"""Crossline Counting scenario count objects crossing a defined
counting line. The line has a polyline shape and is triggered by objects passing
the line in a specified direction.
"""
FENCE = "fence"
"""This scenario makes it possible to define a special fence trigger with a
polyline shape activated by objects passing the line in a certain direction.
"""
MOTION = "motion"
"""This scenario makes it possible to define an include area which acts
as a trigger zone for moving objects. Additionally, filters can be configured to
exclude objects based on other criteria, such as size.
"""
OCCUPANCY_IN_AREA = "occupancyInArea"
"""Occupancy in Area scenario allows defining an include area which are
able to count objects. This include stationary objects.
"""
|
class ScenarioType(enum.StrEnum):
'''Scenario types.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 3 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 68 | 21 | 1 | 5 | 5 | 4 | 15 | 5 | 5 | 4 | 0 | 3 | 0 | 0 |
141,431 |
Kane610/axis
|
axis/models/applications/loitering_guard.py
|
axis.models.applications.loitering_guard.GetConfigurationRequest
|
class GetConfigurationRequest(ApiRequest):
"""Request object for listing Loitering guard configuration."""
method = "post"
path = "/local/loiteringguard/control.cgi"
content_type = "application/json"
api_version: str = API_VERSION
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"apiVersion": self.api_version,
"context": self.context,
"method": "getConfiguration",
}
)
|
class GetConfigurationRequest(ApiRequest):
'''Request object for listing Loitering guard configuration.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.13 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 20 | 3 | 15 | 8 | 12 | 2 | 8 | 7 | 6 | 1 | 1 | 0 | 1 |
141,432 |
Kane610/axis
|
axis/models/mqtt.py
|
axis.models.mqtt.Ssl
|
class Ssl:
"""Represent SSL config."""
validate_server_cert: bool = False
"""Specifies if the server certificate shall be validated."""
ca_cert_id: str | None = None
"""Specifies the CA Certificate that should be used to validate the server certificate.
The certificates are managed through the user interface or via ONVIF services.
"""
client_cert_id: str | None = None
"""Specifies the client certificate and key that should be used.
The certificates are managed through the user interface or via ONVIF services.
"""
@classmethod
def from_dict(cls, data: SslT) -> Self:
"""Create client status object from dict."""
return cls(
validate_server_cert=data["validateServerCert"],
ca_cert_id=data.get("CACertID"),
client_cert_id=data.get("clientCertID"),
)
@classmethod
def from_dict_or_none(cls, data: SslT | None) -> Self | None:
"""Create class instance if data is not None."""
return cls.from_dict(data) if data is not None else None
def to_dict(self) -> SslT:
"""Create json dict from object."""
data: SslT = {"validateServerCert": self.validate_server_cert}
if self.ca_cert_id is not None:
data["CACertID"] = self.ca_cert_id
if self.client_cert_id is not None:
data["clientCertID"] = self.client_cert_id
return data
|
class Ssl:
'''Represent SSL config.'''
@classmethod
def from_dict(cls, data: SslT) -> Self:
'''Create client status object from dict.'''
pass
@classmethod
def from_dict_or_none(cls, data: SslT | None) -> Self | None:
'''Create class instance if data is not None.'''
pass
def to_dict(self) -> SslT:
'''Create json dict from object.'''
pass
| 6 | 4 | 6 | 0 | 5 | 1 | 2 | 0.52 | 0 | 1 | 1 | 0 | 1 | 0 | 3 | 3 | 38 | 6 | 21 | 10 | 15 | 11 | 15 | 8 | 11 | 3 | 0 | 1 | 6 |
141,433 |
Kane610/axis
|
axis/models/parameters/properties.py
|
axis.models.parameters.properties.PropertyParam
|
class PropertyParam(ParamItem):
"""Property parameters."""
api_http_version: int
"""HTTP API version."""
api_metadata: str
"""Support metadata API."""
api_metadata_version: str
"""Metadata API version."""
api_ptz_presets_version: bool | str
"""Preset index for device home position at start-up.
As of version 2.00 of the PTZ preset API Properties.API.PTZ.Presets.Version=2.00
adding, updating and removing presets using param.cgi is no longer supported.
"""
embedded_development: str
"""VAPIX® Application API is supported.
Application list.cgi supported if => 1.20.
"""
firmware_build_date: str
"""Firmware build date."""
firmware_build_number: str
"""Firmware build number."""
firmware_version: str
"""Firmware version."""
image_format: str
"""Supported image formats."""
image_number_of_views: int
"""Amount of supported view areas."""
image_resolution: str
"""Supported image resolutions."""
image_rotation: str
"""Supported image rotations."""
light_control: bool
"""Support light control."""
ptz: bool
"""Support PTZ control."""
digital_ptz: bool
"""Support digital PTZ control."""
system_serial_number: str
"""Device serial number."""
@classmethod
def decode(cls, data: PropertyParamT) -> Self:
"""Decode dictionary to class object."""
return cls(
id="properties",
api_http_version=data["API"]["HTTP"]["Version"],
api_metadata=data["API"].get("Metadata", {}).get("Metadata", "no"),
api_metadata_version=data["API"].get("Metadata", {}).get("Version", "0.0"),
api_ptz_presets_version=data["API"]
.get("PTZ", {})
.get("Presets", {})
.get("Version", False),
embedded_development=data.get("EmbeddedDevelopment", {}).get(
"Version", "0.0"
),
firmware_build_date=data["Firmware"]["BuildDate"],
firmware_build_number=data["Firmware"]["BuildNumber"],
firmware_version=data["Firmware"]["Version"],
image_format=data.get("Image", {}).get("Format", ""),
image_number_of_views=int(data.get("Image", {}).get("NbrOfViews", 0)),
image_resolution=data.get("Image", {}).get("Resolution", ""),
image_rotation=data.get("Image", {}).get("Rotation", ""),
light_control=data.get("LightControl", {}).get("LightControl2", False),
ptz=data.get("PTZ", {}).get("PTZ", False),
digital_ptz=data.get("PTZ", {}).get("DigitalPTZ", False),
system_serial_number=data["System"]["SerialNumber"],
)
|
class PropertyParam(ParamItem):
'''Property parameters.'''
@classmethod
def decode(cls, data: PropertyParamT) -> Self:
'''Decode dictionary to class object.'''
pass
| 3 | 2 | 26 | 0 | 25 | 1 | 1 | 0.53 | 1 | 2 | 1 | 0 | 0 | 0 | 1 | 25 | 85 | 19 | 43 | 3 | 40 | 23 | 19 | 2 | 17 | 1 | 6 | 0 | 1 |
141,434 |
Kane610/axis
|
axis/models/mqtt.py
|
axis.models.mqtt.StatusT
|
class StatusT(TypedDict):
"""Represent a status object."""
connectionStatus: Literal["connected", "disconnected", "not connected"]
state: Literal["active", "inactive"]
|
class StatusT(TypedDict):
'''Represent a status object.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 1 | 3 | 1 | 2 | 1 | 3 | 1 | 2 | 0 | 1 | 0 | 0 |
141,435 |
Kane610/axis
|
axis/models/stream_profile.py
|
axis.models.stream_profile.ListStreamProfilesResponse
|
class ListStreamProfilesResponse(ApiResponse[dict[str, StreamProfile]]):
"""Response object for list sensors response."""
api_version: str
context: str
method: str
data: dict[str, StreamProfile]
# error: ErrorDataT | None = None
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare response data."""
data: ListStreamProfilesResponseT = orjson.loads(bytes_data)
return cls(
api_version=data["apiVersion"],
context=data["context"],
method=data["method"],
data=StreamProfile.decode_to_dict(data["data"].get("streamProfile", [])),
)
|
class ListStreamProfilesResponse(ApiResponse[dict[str, StreamProfile]]):
'''Response object for list sensors response.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare response data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.21 | 1 | 3 | 2 | 0 | 0 | 0 | 1 | 24 | 19 | 2 | 14 | 4 | 11 | 3 | 8 | 3 | 6 | 1 | 6 | 0 | 1 |
141,436 |
Kane610/axis
|
axis/models/stream_profile.py
|
axis.models.stream_profile.ListStreamProfilesResponseT
|
class ListStreamProfilesResponseT(TypedDict):
"""List response."""
apiVersion: str
context: str
method: str
data: ListStreamProfilesDataT
error: NotRequired[ErrorDataT]
|
class ListStreamProfilesResponseT(TypedDict):
'''List response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.17 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 8 | 1 | 6 | 1 | 5 | 1 | 6 | 1 | 5 | 0 | 1 | 0 | 0 |
141,437 |
Kane610/axis
|
axis/models/stream_profile.py
|
axis.models.stream_profile.StreamProfile
|
class StreamProfile(ApiItem):
"""Stream profile item."""
description: str
parameters: str
@property
def name(self) -> str:
"""Stream profile name."""
return self.id
@classmethod
def decode(cls, data: StreamProfileT) -> Self:
"""Decode dict to class object."""
return cls(
id=data["name"],
description=data["description"],
parameters=data["parameters"],
)
|
class StreamProfile(ApiItem):
'''Stream profile item.'''
@property
def name(self) -> str:
'''Stream profile name.'''
pass
@classmethod
def decode(cls, data: StreamProfileT) -> Self:
'''Decode dict to class object.'''
pass
| 5 | 3 | 5 | 0 | 4 | 1 | 1 | 0.23 | 1 | 2 | 1 | 0 | 1 | 0 | 2 | 25 | 19 | 3 | 13 | 5 | 8 | 3 | 7 | 3 | 4 | 1 | 5 | 0 | 2 |
141,438 |
Kane610/axis
|
axis/models/stream_profile.py
|
axis.models.stream_profile.StreamProfileT
|
class StreamProfileT(TypedDict):
"""Stream profile representation."""
name: str
description: str
parameters: str
|
class StreamProfileT(TypedDict):
'''Stream profile representation.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 | 1 | 4 | 1 | 3 | 1 | 4 | 1 | 3 | 0 | 1 | 0 | 0 |
141,439 |
Kane610/axis
|
axis/models/user_group.py
|
axis.models.user_group.GetUserGroupRequest
|
class GetUserGroupRequest(ApiRequest):
"""Request object for listing users."""
method = "get"
path = "/axis-cgi/usergroup.cgi"
content_type = "text/plain"
|
class GetUserGroupRequest(ApiRequest):
'''Request object for listing users.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 6 | 1 | 4 | 4 | 3 | 1 | 4 | 4 | 3 | 0 | 1 | 0 | 0 |
141,440 |
Kane610/axis
|
axis/models/user_group.py
|
axis.models.user_group.GetUserGroupResponse
|
class GetUserGroupResponse(ApiResponse[dict[str, User]]):
"""Response object for listing ports."""
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare API description dictionary."""
data: list[str] = bytes_data.decode().splitlines()
if len(data) == 0:
return cls(data={})
group_list = []
if len(data) == 2:
group_list = data[1].split()
user: UserGroupsT = {
"user": data[0],
"admin": "admin" in group_list,
"operator": "operator" in group_list,
"viewer": "viewer" in group_list,
"ptz": "ptz" in group_list,
}
return cls(data={"0": User.decode(user)})
|
class GetUserGroupResponse(ApiResponse[dict[str, User]]):
'''Response object for listing ports.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare API description dictionary.'''
pass
| 3 | 2 | 19 | 3 | 15 | 1 | 3 | 0.12 | 1 | 5 | 2 | 0 | 0 | 0 | 1 | 24 | 23 | 4 | 17 | 6 | 14 | 2 | 10 | 5 | 8 | 3 | 6 | 1 | 3 |
141,441 |
Kane610/axis
|
axis/models/view_area.py
|
axis.models.view_area.ApiVersionsT
|
class ApiVersionsT(TypedDict):
"""List of supported API versions."""
apiVersions: list[str]
|
class ApiVersionsT(TypedDict):
'''List of supported API versions.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 4 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 1 | 0 | 1 | 0 | 0 |
141,442 |
Kane610/axis
|
axis/models/stream_profile.py
|
axis.models.stream_profile.ListStreamProfilesRequest
|
class ListStreamProfilesRequest(ApiRequest):
"""Request object for listing stream profiles descriptions."""
method = "post"
path = "/axis-cgi/streamprofile.cgi"
content_type = "application/json"
error_codes = error_codes
profiles: list[str] = field(default_factory=list)
api_version: str = API_VERSION
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
profile_list = [{"name": profile} for profile in self.profiles]
return orjson.dumps(
{
"apiVersion": self.api_version,
"context": self.context,
"method": "list",
"params": {"streamProfileName": profile_list},
}
)
|
class ListStreamProfilesRequest(ApiRequest):
'''Request object for listing stream profiles descriptions.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 11 | 0 | 10 | 1 | 1 | 0.11 | 1 | 1 | 0 | 0 | 1 | 0 | 1 | 5 | 25 | 4 | 19 | 11 | 16 | 2 | 11 | 10 | 9 | 1 | 1 | 0 | 1 |
141,443 |
Kane610/axis
|
axis/models/view_area.py
|
axis.models.view_area.ErrorDataT
|
class ErrorDataT(TypedDict):
"""Error data in response."""
code: int
message: str
|
class ErrorDataT(TypedDict):
'''Error data in response.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.33 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 1 | 3 | 1 | 2 | 1 | 3 | 1 | 2 | 0 | 1 | 0 | 0 |
141,444 |
Kane610/axis
|
axis/models/view_area.py
|
axis.models.view_area.GeometryT
|
class GeometryT(TypedDict):
"""Represent a geometry object."""
horizontalOffset: int
horizontalSize: int
verticalOffset: int
verticalSize: int
|
class GeometryT(TypedDict):
'''Represent a geometry object.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 7 | 1 | 5 | 1 | 4 | 1 | 5 | 1 | 4 | 0 | 1 | 0 | 0 |
141,445 |
Kane610/axis
|
axis/models/view_area.py
|
axis.models.view_area.GetSupportedConfigVersionsRequest
|
class GetSupportedConfigVersionsRequest(GetSupportedVersionsRequest):
"""Request object for listing supported API versions."""
path = "/axis-cgi/viewarea/configure.cgi"
|
class GetSupportedConfigVersionsRequest(GetSupportedVersionsRequest):
'''Request object for listing supported API versions.'''
pass
| 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 5 | 4 | 1 | 2 | 2 | 1 | 1 | 2 | 2 | 1 | 0 | 2 | 0 | 0 |
141,446 |
Kane610/axis
|
axis/models/view_area.py
|
axis.models.view_area.GetSupportedVersionsRequest
|
class GetSupportedVersionsRequest(ApiRequest):
"""Request object for listing supported API versions."""
method = "post"
path = "/axis-cgi/viewarea/info.cgi"
content_type = "application/json"
error_codes = general_error_codes
context: str = CONTEXT
@property
def content(self) -> bytes:
"""Initialize request data."""
return orjson.dumps(
{
"context": self.context,
"method": "getSupportedVersions",
}
)
|
class GetSupportedVersionsRequest(ApiRequest):
'''Request object for listing supported API versions.'''
@property
def content(self) -> bytes:
'''Initialize request data.'''
pass
| 3 | 2 | 8 | 0 | 7 | 1 | 1 | 0.14 | 1 | 1 | 0 | 1 | 1 | 0 | 1 | 5 | 19 | 3 | 14 | 8 | 11 | 2 | 8 | 7 | 6 | 1 | 1 | 0 | 1 |
141,447 |
Kane610/axis
|
axis/models/view_area.py
|
axis.models.view_area.GetSupportedVersionsResponse
|
class GetSupportedVersionsResponse(ApiResponse[list[str]]):
"""Response object for supported versions."""
api_version: str
context: str
method: str
data: list[str]
# error: ErrorDataT | None = None
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
"""Prepare response data."""
data: GetSupportedVersionsResponseT = orjson.loads(bytes_data)
return cls(
api_version=data["apiVersion"],
context=data["context"],
method=data["method"],
data=data.get("data", {}).get("apiVersions", []),
)
|
class GetSupportedVersionsResponse(ApiResponse[list[str]]):
'''Response object for supported versions.'''
@classmethod
def decode(cls, bytes_data: bytes) -> Self:
'''Prepare response data.'''
pass
| 3 | 2 | 9 | 0 | 8 | 1 | 1 | 0.21 | 1 | 2 | 1 | 0 | 0 | 0 | 1 | 24 | 19 | 2 | 14 | 4 | 11 | 3 | 8 | 3 | 6 | 1 | 6 | 0 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.