Skip to main content

Python websocket client for reading Gulf IDs

Project description

Read Gulf ID card data

Python package that interfaces with the Gulf ID and EID card reader service. It uses websocket to connect to the service installed on the host machine where a USB smart card reader is connected.

Usage

  • Install the card reader service on a windows machine
  • Ensure the services are running
  • Get the IP of the machine
import aiohttp
from gulf_id_scanner import Client, ServiceError

session = aiohttp.ClientSession()
client = Client(host="192.168.3.45", web_session=session)
# validate connection
try:
    await client.connect()
except ServiceError as err:
    return False

# read card data
try:
  card_data = client.async_read_card():
    # code to process returned card data
except ServiceError as err:
    return
# detect when card is inserted and read card data
try:
  async for card_data in client.async_detect_card():
    # code to process returned card data
except ServiceError as err:
    return
await session.close()

Card Data

The CardData class provides the main card data fields that are commonly required when reading the ID. For more specific fields you can find all the data fields retrived from CardData.card_data.

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

gulf_id_scanner-0.1.0b2.tar.gz (8.8 kB view hashes)

Uploaded Source

Built Distribution

gulf_id_scanner-0.1.0b2-py3-none-any.whl (9.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page