A python package for Kisi API
Project description
Kisi
KISI: The go-to access control app.
This Python library provides convenient access to the Kisi API, allowing you to manage groups, calendars, and cameras programmatically. Kisi is an easy to use cloud based software to manage access to your doors. For physical access use your smartphone's mobile App or secure badges to unlock and open door.
Request Feature/Suggestion: https://forms.gle/efGD5DuTpWsX96GG7
Installation
pip install kisi
Kisi supports Python 3+.
Usage
Default
import kisi
Authentication
Before making requests, you need to authenticate using your Kisi API key. Initialize the Connect
class with your API key:
from kisi import Connect
api_key = 'your_kisi_api_key'
ks = Connect(api_key)
OR
import kisi
api_key = 'your_kisi_api_key'
ks = kisi.Connect(api_key)
Generate Key from Kisi API
Users
Fetch Users
# Fetch users with optional parameters
users = ks.fetch_users(confirmed=True, group_id=1, limit=20, offset=0)
print(users)
Create User
# Create a new user
new_user = ks.create_user(name='John Doe', email='john@example.com', password='securepassword')
print(new_user)
Fetch User
# Fetch a specific user by user_id
user = ks.fetch_user(user_id=123)
print(user)
Update User
# Update user details
updated_user = ks.update_user(user_id=123, name='John Doe Jr.')
print(updated_user)
Delete User
# Delete a user by user_id
ks.delete_user(user_id=123)
Fetch Current User
# Fetch details of the current authenticated user
current_user = ks.fetch_current_user()
print(current_user)
Update Current User
# Update details of the current authenticated user
updated_current_user = ks.update_current_user(name='Jane Doe')
print(updated_current_user)
Delete Current User
# Delete the current authenticated user
ks.delete_current_user()
Register User
# Register a new user
register_user = ks.register_user(name='Jane Doe', email='jane@example.com', password='securepassword', terms_and_conditions=True)
print(register_user)
Groups
Fetch Groups
# Fetch groups with optional parameters
groups = ks.fetch_groups(limit=10, offset=0)
print(groups)
Create Group
# Create a new group
new_group = ks.create_group(name='Engineering Team')
print(new_group)
Fetch Group
# Fetch a specific group by group_id
group = ks.fetch_group(group_id=1)
print(group)
Update Group
# Update group details
updated_group = ks.update_group(group_id=1, name='DevOps Team')
print(updated_group)
Delete Group
# Delete a group by group_id
ks.delete_group(group_id=1)
Cards
Fetch Cards
# Fetch cards with optional parameters
cards = ks.fetch_cards(limit=10, offset=0)
print(cards)
Create Card
# Create a new card
new_card = ks.create_card(token='token_value', card_type='rfid')
print(new_card)
Fetch Card
# Fetch a specific card by card_id
card = ks.fetch_card(cardIdentifier='card_id_value')
print(card)
Update Card
# Update card details
updated_card = ks.update_card(card_id='card_id_value', two_factor_pin='1234')
print(updated_card)
Delete Card
# Delete a card by card_id
ks.delete_card(card_id='card_id_value')
Locks
Fetch Locks
# Fetch locks with optional parameters
locks = ks.fetch_locks(limit=10, offset=0)
print(locks)
Create Lock
# Create a new lock
new_lock = ks.create_lock(name='Main Entrance', place_id=1)
print(new_lock)
Fetch Lock
# Fetch a specific lock by lock_id
lock = ks.fetch_lock(lock_id=1)
print(lock)
Update Lock
# Update lock details
updated_lock = ks.update_lock(lock_id=1, name='Back Door')
print(updated_lock)
Delete Lock
# Delete a lock by lock_id
ks.delete_lock(lock_id=1)
Cameras
Fetch Cameras
# Fetch cameras with optional parameters
cameras = ks.fetch_cameras(limit=10, place_id=1)
print(cameras)
Create Camera
# Create a new camera
new_camera = ks.create_camera(lock_id=1, remote_id='camera_001', name='Main Lobby Camera')
print(new_camera)
Fetch Camera
# Fetch a specific camera by camera_id
camera = ks.fetch_camera(camera_id=1)
print(camera)
Update Camera
# Update camera details
updated_camera = ks.update_camera(camera_id=1, name='Main Lobby Camera New')
print(updated_camera)
Delete Camera
# Delete a camera by camera_id
ks.delete_camera(camera_id=1)
Calendars
Fetch Summary
# Fetch calendar summary with required parameters
summary = ks.fetch_summary(around='2024-06-17', consequence='consequence_value')
print(summary)### Groups
Fetching Groups
groups = ks.group.fetch_groups()
print(groups)
Creating a Group
new_group = ks.group.create_group(name='Engineering Team', description='Access to engineering floors')
print(new_group)
Fetching a Group
group_info = ks.group.fetch_group(group_id=123)
print(group_info)
Updating a Group
update_result = ks.group.update_group(group_id=123, name='New Name', description='New Description')
print(update_result)
Deleting a Group
delete_result = ks.group.delete_group(group_id=123)
print(delete_result)
Calendars
Fetching Calendar Summary
summary = ks.calendar.fetch_summary(around='2024-06-14', consequence='upcoming')
print(summary)
Cameras
Fetching Cameras
cameras = ks.camera.fetch_cameras()
print(cameras)
Creating a Camera
new_camera = ks.camera.create_camera(lock_id=456, remote_id='abc123', name='Office Camera')
print(new_camera)
Fetching a Camera
camera_info = ks.camera.fetch_camera(camera_id=789)
print(camera_info)
Updating a Camera
update_status = ks.camera.update_camera(camera_id=789, name='Updated Camera')
print(update_status)
Deleting a Camera
delete_status = ks.camera.delete_camera(camera_id=789)
print(delete_status)
License
This project is licensed under the MIT License - see the LICENSE file for details.
This `README.md` provides a structured guide to using your library, including installation instructions, usage examples for each API action (groups, calendars, cameras), and licensing information. Adjust the examples as needed to match the specifics of your API client implementation and usage scenarios.
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
Built Distribution
File details
Details for the file kisi-1.3.tar.gz
.
File metadata
- Download URL: kisi-1.3.tar.gz
- Upload date:
- Size: 8.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 01cc6a3036a11436018d438908ce025fae2ad82a06accb16c6db204ff77b25d4 |
|
MD5 | bcce5691f3164f027170f25422029a45 |
|
BLAKE2b-256 | 4023e1ac5018c5a86d4dbb1788cc759dc9fc7e4ce4c4a4f8468f33f265d14063 |
File details
Details for the file Kisi-1.3-py3-none-any.whl
.
File metadata
- Download URL: Kisi-1.3-py3-none-any.whl
- Upload date:
- Size: 7.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b140d65017b43121fe20ac9d787e4fa895ccad5229b1d00170ea73d57c73f2d |
|
MD5 | 52b6d8ed93d98dcf7293ee013cf745e2 |
|
BLAKE2b-256 | 7779563de0641d271edb514eefc834a97f53cf336fa90efc5073b13b5cc908ba |