Code Monkey home page Code Monkey logo

foscam-python-lib's Introduction

foscam-python-lib

Foscam Python2 Library for H.264 IP Cameras (FI9821W/P/HD816W/P)

TODO

  1. Support more camera models.

Getting Started

Install

$ pip install pyfoscam

Simple example

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

from foscam import FoscamCamera
from time import sleep

mycam = FoscamCamera('192.168.0.110', 88, 'admin', 'pwd')
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.110', 88, 'admin', 'pwd', 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 foscam 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.110', 88, 'admin', 'pwd', daemon=False)
mycam.get_ip_info(print_ipinfo)

foscam-python-lib's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.