test missing timeout

This commit is contained in:
Arturo Hernandez 2018-08-21 09:00:46 -04:00
parent d3e587a756
commit a726545d18
2 changed files with 20 additions and 11 deletions

View File

@ -7,10 +7,22 @@ pyzk is an unofficial library of zksoftware the fingerprint attendance machine.
[![Build Status](https://travis-ci.org/kurenai-ryu/pyzk.svg?branch=master)](https://travis-ci.org/kurenai-ryu/pyzk) [![Build Status](https://travis-ci.org/kurenai-ryu/pyzk.svg?branch=master)](https://travis-ci.org/kurenai-ryu/pyzk)
replace original pyzk, if it was installed replace original pyzk, if it was installed
`pip install -U git+https://github.com/kurenai-ryu/pyzk.git`
```sh
pip install -U git+https://github.com/kurenai-ryu/pyzk.git
```
or using pipenv:
```sh
pipenv install git+https://gith.com/kurenai-ryu/pyzk#egg=pyzk
```
or clone and execute: or clone and execute:
`python setup.py install`
```sh
python setup.py install
```
or in your project, append the path of this project or in your project, append the path of this project
@ -68,21 +80,21 @@ finally:
* Connect/Disconnect * Connect/Disconnect
``` ```python
conn = zk.connect() conn = zk.connect()
conn.disconnect() conn.disconnect()
``` ```
* Disable/Enable Connected Device * Disable/Enable Connected Device
``` ```python
conn.disable_device() conn.disable_device()
conn.enable_device() conn.enable_device()
``` ```
* Get and Set Time * Get and Set Time
``` ```python
from datetime import datetime from datetime import datetime
zktime = conn.get_time() zktime = conn.get_time()
@ -95,7 +107,7 @@ conn.set_time(newtime)
* Ger Firmware Version and extra information * Ger Firmware Version and extra information
``` ```python
conn.get_firmware_version() conn.get_firmware_version()
conn.get_serialnumber() conn.get_serialnumber()
conn.get_platform() conn.get_platform()
@ -235,7 +247,6 @@ optional arguments:
-F FINGER, --finger FINGER -F FINGER, --finger FINGER
Finger for enroll (fid=0) Finger for enroll (fid=0)
``` ```
# Compatible devices # Compatible devices
@ -288,8 +299,6 @@ Platform : JZ4725_TFT
DeviceName : K14 (not tested, but same behavior like the other one) DeviceName : K14 (not tested, but same behavior like the other one)
``` ```
### Not Working (needs more tests, more information) ### Not Working (needs more tests, more information)
``` ```
@ -300,8 +309,6 @@ DeviceName : iClock260 (no capture data - probably similar problem as the latest
If you have another version tested and it worked, please inform me to update this list! If you have another version tested and it worked, please inform me to update this list!
# Related Project (TODO: check compatibility with this fork) # Related Project (TODO: check compatibility with this fork)
* [zkcluster](https://github.com/fananimi/zkcluster/ "zkcluster project") is a django apps to manage multiple fingerprint devices. * [zkcluster](https://github.com/fananimi/zkcluster/ "zkcluster project") is a django apps to manage multiple fingerprint devices.

View File

@ -140,9 +140,11 @@ class ZK(object):
""" based on self.tcp""" """ based on self.tcp"""
if self.tcp: if self.tcp:
self.__sock = socket(AF_INET, SOCK_STREAM) self.__sock = socket(AF_INET, SOCK_STREAM)
self.__sock.settimeout(self.__timeout)
self.__sock.connect_ex(self.__address) self.__sock.connect_ex(self.__address)
else: else:
self.__sock = socket(AF_INET, SOCK_DGRAM) self.__sock = socket(AF_INET, SOCK_DGRAM)
self.__sock.settimeout(self.__timeout)
def __create_tcp_top(self, packet): def __create_tcp_top(self, packet):
""" witch the complete packet set top header """ """ witch the complete packet set top header """