pycosec
pycosec is a Python library that provides an easy interface to interact with COSEC biometric devices. It allows you to manage users, configure device settings, retrieve attendance events, and handle credentials programmatically.
Features
- Configure device settings such as IP, time, and access control.
- Manage users (add, update, delete).
- Enable/disable face recognition and other special features.
- Retrieve attendance events (punch-in/punch-out).
- Manage user credentials (fingerprint, card, palm, face templates/images).
- Support for alarms, door features, and system timers.
- Works with COSEC API using HTTP Basic authentication.
Installation
Install via pip:
pip install pycosec
Or clone the repository and install locally:
git clone https://github.com/KSreethul/pycosec.git
cd pycosec
pip install .
Requirements
- Python 3.10+
requestslibrary (>=2.0)
Usage
from pycosec import COSECBiometric
# Initialize device connection
device = COSECBiometric(
machine_ip="192.168.1.100",
port=80,
username="admin",
password="password"
)
# Retrieve total number of users
user_count = device.get_user_count()
print("Total Users:", user_count)
# Add or update a user
response = device.set_cosec_user(
user_id="1001",
ref_user_id=1,
name="John Doe",
user_active=True,
card1="1234567890",
enable_fr=True
)
print(response)
# Retrieve attendance events
events = device.get_attendance_events(no_of_events=50)
print(events)
Documentation
The library provides methods to configure and interact with:
-
Device Settings
basic_config(),finger_reader_parameter_configuration(),enrollment_configuration(),access_settings_configuration(),alarm_configuration(),date_and_time_configuration(),door_features_configuration(),system_timer_configuration(),special_function_configuration(),wiegand_interface(),smart_card_format()
-
User Management
get_cosec_user(),set_cosec_user(),delete_cosec_user(),enable_user_face_recognition(),get_user_credential(),get_user_credential_count(),delete_cosec_user_credential()
-
Attendance
get_attendance_events()
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch:
git checkout -b feature-name. - Make your changes and commit:
git commit -m "Add feature". - Push to your branch:
git push origin feature-name. - Create a Pull Request.
License
This project is licensed under the LGPL 3.0 license. See [LICENSE](https://www.gnu.org/licenses/lgpl-3.0.html) for details.
Links
- Homepage: https://github.com/KSreethul/pycosec
- Bug Tracker: https://github.com/KSreethul/pycosec/issues
Release files for pycosec 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pycosec-0.1.0.tar.gz | 11.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pycosec-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.3 kB
Release files / pycosec-0.1.0.tar.gz
| Download URL | pycosec-0.1.0.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dab0edf0c77eeb5a09e39375669efd423fb7a853df41db305b6e94a4c4829690
|
|
BLAKE2b-256 checksum How to use checksums |
156b283c7ad6270576cc3a24dc461da0d523dac06e83dd799f12b35916b41448
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.0
|
Release files / pycosec-0.1.0-py3-none-any.whl
| Download URL | pycosec-0.1.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c0717a72e6cf47a06b7e6ea2277551c3009db56387414690d1d39d4f254d3006
|
|
BLAKE2b-256 checksum How to use checksums |
76c974019c587a40b61ee3180a3a8bb7ea27056c328da7c9c489f8f6c0bcd50c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.0
|