Skip to main content

Official Python SDK for the MachineID.io API

Project description

MachineID Python SDK

Official Python client for the MachineID device enforcement API.

Install

pip install machineid-io

Initialize

from machineid_io.client import MachineIDClient

client = MachineIDClient( org_key="YOUR_ORG_KEY" )

Register Device

Idempotent. Safe to call every time your agent starts.

client.register("agent-01")

Validate (Runtime Gate)

This is the enforcement checkpoint.
Your process must stop immediately when allowed is False.

res = client.validate("agent-01")

if not res.allowed: print("Denied:", res.code, res.request_id) raise SystemExit(1)

Validate Result Fields

<<<<<<< HEAD

Register device (idempotent)

reg = client.register(device_id)

if reg["status"] not in ("ok", "exists"): raise RuntimeError(f"Register failed: {reg}")

print("Register success:", reg["status"])

  • allowed — True or False
  • code — Stable decision code (ALLOW, DEVICE_REVOKED, PLAN_FROZEN, etc.)
  • request_id — Correlation ID for logs and support
  • status, reason — Legacy fields (still included)
  • raw — Full raw API response

78df738 (Python SDK: POST validate + decision codes + request_id)

Revoke Device

Stops the device on its next validate call.

client.revoke("agent-01")

Unrevoke Device

Explicitly re-grants execution authority.

client.unrevoke("agent-01")

List Devices

devices = client.list_devices() print(devices)

Enforcement Model

MachineID is an authority layer, not a process manager.

  • Revoke = execution must stop
  • Unrevoke does not auto-restart
  • Validate is the single source of truth

Always gate execution on validate().

License

MIT

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

machineid_io-0.1.3.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

machineid_io-0.1.3-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file machineid_io-0.1.3.tar.gz.

File metadata

  • Download URL: machineid_io-0.1.3.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for machineid_io-0.1.3.tar.gz
Algorithm Hash digest
SHA256 4fab0c3694cec0189c8250a577a901f03931bd47735d344b846df85a7280a2e6
MD5 4161d2d7f746b5083049217ea25ce8c6
BLAKE2b-256 d9311e870594e9d353c0e67b49ee61727e1085e77fb88c9a8a70b1f661b5a044

See more details on using hashes here.

File details

Details for the file machineid_io-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: machineid_io-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for machineid_io-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 f416416505d2d6a904d50c824e5252c227419c6735ce1a4b8f025b151e725241
MD5 09e3f106dbf77210677c6db748b5b1b7
BLAKE2b-256 eaabff7d0d3d926db90f237c93ec67ddce99f2ea4d8e1fd2b13cbe22c7585f28

See more details on using hashes here.

Supported by

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