Skip to main content

Python Library for Foscam IP Cameras

Project description

Python Library for Foscam IP Cameras

Getting Started

Install

$ pip install python-foscam

Simple example

Here is a simple example to move camera lens up and stop after 1s.

from libpyfoscam import FoscamCamera
from time import sleep

mycam = FoscamCamera('192.168.0.113', 88, 'admin', 'superuser')
mycam.ptz_move_up()
sleep(1)
mycam.ptz_stop_run()

Asynchronous feature

This example uses the asynchronous feature provided by FoscamCamera.

Normally, a command is sent synchronously, waiting for results and blocking the main thread.

By initializing FoscamCamera with daemon=True (defaults to False), commands are sent asynchronously.

mycam = FoscamCamera('192.168.0.113', 88, 'admin', 'superuser', daemon=True)
mycam.get_ip_info()
mycam.get_port_info()
mycam.refresh_wifi_list()

Send command with callback

This example illustrates the use of a callback function when the command completes.

from libpyfoscam import FoscamCamera, FOSCAM_SUCCESS
def print_ipinfo(returncode, params):
    if returncode != FOSCAM_SUCCESS:
        print 'Failed to get IPInfo!'
        return
    print 'IP: %s, Mask: %s' % (params['ip'], params['mask'])

mycam = FoscamCamera('192.168.0.113', 88, 'admin', 'superuser', daemon=False)
mycam.get_ip_info(print_ipinfo)

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

libpyfoscam-1.2.2.tar.gz (20.9 kB view details)

Uploaded Source

Built Distribution

libpyfoscam-1.2.2-py3-none-any.whl (20.3 kB view details)

Uploaded Python 3

File details

Details for the file libpyfoscam-1.2.2.tar.gz.

File metadata

  • Download URL: libpyfoscam-1.2.2.tar.gz
  • Upload date:
  • Size: 20.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for libpyfoscam-1.2.2.tar.gz
Algorithm Hash digest
SHA256 14b3dead5cf1dbeddfe5b8a2aadd091c98c1b8c21a95406463e6c66f64a155aa
MD5 08a8a115359939ff836290af602e5579
BLAKE2b-256 dfd603ac4173fcea8cb5462277d47db6c41c72dc438336735cd16bdf39c40a35

See more details on using hashes here.

File details

Details for the file libpyfoscam-1.2.2-py3-none-any.whl.

File metadata

  • Download URL: libpyfoscam-1.2.2-py3-none-any.whl
  • Upload date:
  • Size: 20.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.10

File hashes

Hashes for libpyfoscam-1.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 c1a5f040c5f951bdad9275a22e8551f6f7669f6ab0641bec507ac7f5e9f04707
MD5 458a9108fd79825ca8117114597f0c3b
BLAKE2b-256 1ef58a181cb6179c984b1ec75e5b4f5a2bc4c39e5221cb52b5c919d3efe3373a

See more details on using hashes here.

Supported by

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