|
| 1 | +================= |
1 | 2 | foscam-python-lib |
2 | 3 | ================= |
3 | 4 |
|
4 | | -Foscam Python Library for H.264 IP Cameras (FI9821W/P/HD816W/P) |
| 5 | +.. image:: https://img.shields.io/pypi/v/pyfoscam.svg |
| 6 | + :target: https://pypi.python.org/pypi/pyfoscam |
| 7 | + |
| 8 | +Foscam Python2 Library for H.264 IP Cameras (FI9821W/P/HD816W/P) |
5 | 9 |
|
6 | 10 | TODO |
7 | | ----- |
8 | | -1. Package setup.py and upload to pypi. |
9 | | -2. Support more camera models. |
| 11 | +==== |
| 12 | + |
| 13 | +1. Support more camera models. |
10 | 14 |
|
11 | 15 | Getting Started |
12 | | ---------------- |
13 | | -### Simple example: |
| 16 | +=============== |
| 17 | + |
| 18 | +Install |
| 19 | +------- |
| 20 | + |
| 21 | + |
| 22 | +.. code:: bash |
| 23 | +
|
| 24 | + $ pip install pyfoscam |
| 25 | +
|
| 26 | +Simple example |
| 27 | +-------------- |
14 | 28 | Here is a simple example to move camera lens up and stop after 1s. |
15 | | -```python |
| 29 | + |
| 30 | +.. code:: python |
| 31 | +
|
16 | 32 | from foscam import FoscamCamera |
17 | 33 | from time import sleep |
18 | 34 |
|
19 | | - mycam = FoscamCamera('192.168.0.110', 88, 'admin', 'foscam') |
| 35 | + mycam = FoscamCamera('192.168.0.110', 88, 'admin', 'pwd') |
20 | 36 | mycam.ptz_move_up() |
21 | 37 | sleep(1) |
22 | 38 | mycam.ptz_stop_run() |
23 | | -``` |
24 | 39 |
|
25 | | -### Asynchronous feature: |
| 40 | +Asynchronous feature |
| 41 | +-------------------- |
26 | 42 | This example uses the asynchronous feature provided by ``FoscamCamera``. |
| 43 | + |
27 | 44 | Normally, a command is sent synchronously, waiting for results and blocking the main thread. |
| 45 | + |
28 | 46 | By initializing ``FoscamCamera`` with `daemon=True` (defaults to False), commands are sent asynchronously. |
29 | | -```python |
30 | | - mycam = FoscamCamera('192.168.0.110', 88, 'admin', 'foscam', daemon=True) |
| 47 | + |
| 48 | +.. code:: python |
| 49 | +
|
| 50 | + mycam = FoscamCamera('192.168.0.110', 88, 'admin', 'pwd', daemon=True) |
31 | 51 | mycam.get_ip_info() |
32 | 52 | mycam.get_port_info() |
33 | 53 | mycam.refresh_wifi_list() |
34 | | -``` |
35 | 54 |
|
36 | | -### Send command with callback: |
| 55 | +
|
| 56 | +Send command with callback |
| 57 | +-------------------------- |
37 | 58 | This example illustrates the use of a callback function when the command completes. |
38 | | -```python |
| 59 | + |
| 60 | +.. code:: python |
| 61 | +
|
39 | 62 | from foscam import FoscamCamera, FOSCAM_SUCCESS |
40 | 63 | def print_ipinfo(returncode, params): |
41 | 64 | if returncode != FOSCAM_SUCCESS: |
42 | 65 | print 'Failed to get IPInfo!' |
43 | 66 | return |
44 | 67 | print 'IP: %s, Mask: %s' % (params['ip'], params['mask']) |
45 | 68 |
|
46 | | - mycam = FoscamCamera('192.168.0.110', 88, 'admin', 'foscam', daemon=False) |
| 69 | + mycam = FoscamCamera('192.168.0.110', 88, 'admin', 'pwd', daemon=False) |
47 | 70 | mycam.get_ip_info(print_ipinfo) |
48 | | -``` |
|
0 commit comments