Client API Reference
This page provides an automatically generated API reference for the main public entrypoints of the library.
Clients
SyncClient
SyncClient(
client_id: str,
client_secret: str,
version: str = "v1",
extra_prefix: str = "",
env: MqApiEnvironment = PROD,
)
Synchronous client for MachineQ API.
Parameters:
-
(client_idstr) –OAuth client ID
-
(client_secretstr) –OAuth client secret
-
(versionstr, default:'v1') –version of the API to use (default: v1)
-
(extra_prefixstr, default:'') –extra prefix between the /{api_version} and {endpoint}. May be useful for some deprecated APIs.
-
(envMqApiEnvironment, default:PROD) –API environment (default: production)
Methods:
-
close–Close the underlying HTTP client session.
Attributes:
-
account– -
api_version– -
applications– -
auth– -
decoder_types– -
device_groups– -
device_profiles– -
devices– -
extra_prefix– -
gateway_groups– -
gateway_profiles– -
gateways– -
http_client– -
logs– -
multicast_groups– -
output_profiles– -
rf_regions– -
roles– -
service_profiles– -
users– -
version–
auth
instance-attribute
auth = MqAuth(
client_id=client_id,
client_secret=client_secret,
client=http_client,
env=env,
)
http_client
instance-attribute
http_client = http_client
close
close() -> None
Close the underlying HTTP client session.
AsyncClient
AsyncClient(
client_id: str,
client_secret: str,
version: str = "v1",
extra_prefix: str = "",
env: MqApiEnvironment = PROD,
)
Asynchronous client for MachineQ API.
Parameters:
-
(client_idstr) –OAuth client ID
-
(client_secretstr) –OAuth client secret
-
(versionstr, default:'v1') –version of the API to use (default: v1)
-
(extra_prefixstr, default:'') –extra prefix between the /{api_version} and {endpoint}. May be useful for some deprecated APIs.
-
(envMqApiEnvironment, default:PROD) –API environment (default: production)
Methods:
-
aclose–Close the underlying HTTP client session.
Attributes:
-
account– -
api_version– -
applications– -
auth– -
decoder_types– -
device_groups– -
device_profiles– -
devices– -
extra_prefix– -
gateway_groups– -
gateway_profiles– -
gateways– -
http_client– -
logs– -
multicast_groups– -
output_profiles– -
rf_regions– -
roles– -
service_profiles– -
users– -
version–
http_client
instance-attribute
http_client = AsyncClient(
headers={"User-Agent": f"machineq-py/{__version__}"}
)
aclose
async
aclose() -> None
Close the underlying HTTP client session.
Exceptions
APIError
APIError(
message: str,
code: int | None = None,
details: list[Any] | None = None,
status_code: int | None = None,
)
Bases: MachineQError
Base exception for API errors.
Parameters:
-
(messagestr) –Error message
-
(codeint | None, default:None) –gRPC error code
-
(detailslist[Any] | None, default:None) –gRPC error details
-
(status_codeint | None, default:None) –HTTP status code
Attributes:
-
code– -
details– -
message– -
status_code–
MachineQError
ValidationError
NotFound
PermissionDenied
Unauthorized
See also: Data models for base types.