Skip to main content

Python Library for Vivotek IP Cameras

Project description

python-vivotek

Verify Maintainability

A Python library for Vivotek IP cameras.

Getting Started

Install

This library currently supports Python 3.6 and up.

For Python 3.5 use v0.4.0

pip3 install libpyvivotek

# Or for only the current user
pip3 install --user libpyvivotek

Usage

from libpyvivotek import VivotekCamera

cam = VivotekCamera(host='192.168.1.123', port=443, usr='user', pwd='passw0rd',
                    digest_auth=True, ssl=True, verify_ssl=True, sec_lvl='admin')
print("Camera model is %s" % cam.model_name)
# Camera model is IB8369A

Authentication

Some camera models use digest by default so if you know the credentials are correct but are still seeing "Unauthorized" then try with digest_auth=True.

Security Level

Four security levels are currently supported:

  • anonymous
  • viewer
  • operator
  • admin

Using the anonymous security level does not require a user or password. The operator or admin security level is required to set parameters.

Load password from Keyring

We can use Python Keyring to load the password rather than from a string.

# Install the package
pip install --user keyring

# Set the password using the command-line interface.
python -m keyring set camera user passw0rd
import keyring
from libpyvivotek import VivotekCamera

cam = VivotekCamera(host='192.168.1.123', port=443, usr='user',
                    pwd=keyring.get_password('camera', 'user'), sec_lvl='admin')
print("Camera model is %s" % cam.model_name)
# Camera model is IB8369A

View a snapshot image

We can optionally specify the image quality to snapshot() from 1 to 5 with a default of 3.

from libpyvivotek import VivotekCamera
from PIL import Image
from io import BytesIO
import keyring

cam = VivotekCamera(host='192.168.1.123', port=443, usr='user',
                    pwd=keyring.get_password('camera', 'user'), sec_lvl='admin')

snapshot = Image.open(BytesIO(cam.snapshot(quality=3)))

snapshot.show()

Getting parameters

cam.get_param('capability_api_httpversion')
# "0311b_1"

cam.get_param('capability_naudioin')
# "0"

cam.get_param('capability_protocol_https')
# "1"

cam.get_param('event_i0_enable')
# "1"

cam.get_param('motion_c0_enable')
# "1"

Setting parameters

cam.set_param('event_i0_enable', 1)
# "1"

cam.set_param('event_i0_enable', 0)
# "0"

Developing

Install dependencies and run the test suite for a sanity check.

pip install --user -r requirements_test.txt
pip install --user pytest
pytest

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

libpyvivotek-0.6.1.tar.gz (16.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

libpyvivotek-0.6.1-py3-none-any.whl (17.0 kB view details)

Uploaded Python 3

File details

Details for the file libpyvivotek-0.6.1.tar.gz.

File metadata

  • Download URL: libpyvivotek-0.6.1.tar.gz
  • Upload date:
  • Size: 16.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for libpyvivotek-0.6.1.tar.gz
Algorithm Hash digest
SHA256 9f73bc05919119b7d88ac9354782fbb0003e52db6dfcca8f977e3445683af602
MD5 219d65b8dfbf27807a246fd2c2fa2be4
BLAKE2b-256 888f1ea65a6e1e9dd2f74c6c5914ebdddfd37fcf5f198fd1646f6b5e5e8c56cc

See more details on using hashes here.

File details

Details for the file libpyvivotek-0.6.1-py3-none-any.whl.

File metadata

  • Download URL: libpyvivotek-0.6.1-py3-none-any.whl
  • Upload date:
  • Size: 17.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for libpyvivotek-0.6.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2e14bd6cf13091d59cbf0da1e9880a13905ba14df68a663ae3ac2a7cff1550f9
MD5 886c3e8fb56c5d3c7a1ff7d3d2ea420b
BLAKE2b-256 9bdc52b590b8b516dea10fe40c517343392781c1f5b38c414cd3c8e938c7f7e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page