Synchronous Python client for the gomc-rest API
Project description
gomc-rest-client
Python 3.10+ client library for the latest gomc-rest HTTP API.
This package wraps the synchronous REST endpoints exposed by gomc-rest for Mitsubishi PLC read, write, and remote-control operations using only the Python standard library, and converts API error responses into typed Python exceptions.
About gomc-rest-client
This package is a dedicated client library for gomc-rest. It is intended for users who already use gomc-rest, or who want to expose Mitsubishi PLC operations through the gomc-rest HTTP API.
This library does not communicate with PLCs directly. If you need the server, API surface, or gomc-rest itself, see the upstream project:
Install
uv add gomc-rest-client
With pip:
pip install gomc-rest-client
PyPI project page:
For offline environments, install from a prebuilt wheel distributed inside your network:
pip install dist/gomc_rest_client-*.whl
This package has no runtime dependencies outside the Python standard library, so wheel-based offline installation is straightforward.
Development tasks currently use dev dependencies such as PyYAML, pytest, ruff, and ty, but they are not required at runtime.
To set up the development environment:
uv sync --group dev
To build distributable artifacts before taking them into an offline environment:
uv build
Usage
from gomc_rest_client import (
MINIMUM_SUPPORTED_GOMC_REST_VERSION,
GomcRestBusyError,
GomcRestPLCProtocolError,
PLCClient,
)
with PLCClient("http://192.168.0.1:8080") as plc:
health = plc.health()
metrics = plc.metrics()
info = plc.info()
version = plc.version()
is_supported = plc.is_supported_version()
is_compatible = plc.is_version_compatible(MINIMUM_SUPPORTED_GOMC_REST_VERSION)
values = plc.read("D100", 3)
bits = plc.read("M0", 4)
dwords = plc.read("D100", 2, dword=True)
signed = plc.read("D100", 3, sint=True)
plc.write("D100", [10, 20, 30])
plc.write("M0", [True, False])
plc.write("D100", [-1, -32768, 32767], sint=True)
try:
plc.remote_run(clear=0, force=False)
except GomcRestBusyError:
pass
except GomcRestPLCProtocolError as exc:
print(exc.end_code, exc.message)
is_supported_version() and is_version_compatible() treat dev builds as compatible by default so local gomc-rest main builds can pass version checks during development.
Supported gomc-rest versions
This client supports gomc-rest v0.9.0 and later.
Servers older than v0.9.0 are not supported. In particular, servers without the /version endpoint are out of scope for this client.
This client expects the server to expose /version, /info, and /metrics.
If you need to verify the support policy at runtime, call plc.is_supported_version() or compare against MINIMUM_SUPPORTED_GOMC_REST_VERSION.
API coverage
- GET /version
- GET /info
- GET /metrics
- GET /health
- GET /read
- POST /write
- POST /remote/run
- POST /remote/stop
- POST /remote/pause
- POST /remote/latch-clear
- POST /remote/reset
Remote-control endpoints require the gomc-rest server to start with -enable-remote.
Development
Run checks with uv:
uv run pytest
uv run ruff check .
uv run ty check
uv build
To publish to PyPI after configuring credentials:
uv publish
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gomc_rest_client-0.5.0.tar.gz.
File metadata
- Download URL: gomc_rest_client-0.5.0.tar.gz
- Upload date:
- Size: 17.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6144e85b34c11cda1eea5bdb3ea65ae2f211d245abab9f738214eab010e3ed53
|
|
| MD5 |
d01e5867846917f91ef5bfba430341e4
|
|
| BLAKE2b-256 |
00431b2d17f18ae84a5c380659f198f32069b1dd808a4ab67aa303825692c006
|
Provenance
The following attestation bundles were made for gomc_rest_client-0.5.0.tar.gz:
Publisher:
workflow.yml on Moge800/gomc_rest_client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gomc_rest_client-0.5.0.tar.gz -
Subject digest:
6144e85b34c11cda1eea5bdb3ea65ae2f211d245abab9f738214eab010e3ed53 - Sigstore transparency entry: 1566681220
- Sigstore integration time:
-
Permalink:
Moge800/gomc_rest_client@e152dbfd6392027a37c48aa8cb9b36a37717648b -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/Moge800
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@e152dbfd6392027a37c48aa8cb9b36a37717648b -
Trigger Event:
release
-
Statement type:
File details
Details for the file gomc_rest_client-0.5.0-py3-none-any.whl.
File metadata
- Download URL: gomc_rest_client-0.5.0-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fcb452bad9a4971bcec3dd4341824443bfa521fef7b170941ec2d13679012db9
|
|
| MD5 |
7641ddb92dd439008569ef5bc67af823
|
|
| BLAKE2b-256 |
2d4e75f0348509b5226552db4ceb85ccdfae23c3ec9c33ac3f654ccfe46ee340
|
Provenance
The following attestation bundles were made for gomc_rest_client-0.5.0-py3-none-any.whl:
Publisher:
workflow.yml on Moge800/gomc_rest_client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gomc_rest_client-0.5.0-py3-none-any.whl -
Subject digest:
fcb452bad9a4971bcec3dd4341824443bfa521fef7b170941ec2d13679012db9 - Sigstore transparency entry: 1566681236
- Sigstore integration time:
-
Permalink:
Moge800/gomc_rest_client@e152dbfd6392027a37c48aa8cb9b36a37717648b -
Branch / Tag:
refs/tags/v0.5.0 - Owner: https://github.com/Moge800
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@e152dbfd6392027a37c48aa8cb9b36a37717648b -
Trigger Event:
release
-
Statement type: