MCPcopy Create free account
hub / github.com/tiny-pilot/tinypilot / hostname_get

Function hostname_get

app/api.py:460–477  ·  view source on GitHub ↗

Determines the hostname of the machine. Returns: On success, a JSON data structure with the following properties: hostname: string. Example: { "hostname": "tinypilot" } Returns an error object on failure.

()

Source from the content-addressed store, hash-verified

458@api_blueprint.route('/hostname', methods=['GET'])
459@required_auth(auth.Role.ADMIN)
460def hostname_get():
461 """Determines the hostname of the machine.
462
463 Returns:
464 On success, a JSON data structure with the following properties:
465 hostname: string.
466
467 Example:
468 {
469 "hostname": "tinypilot"
470 }
471
472 Returns an error object on failure.
473 """
474 try:
475 return json_response.success({'hostname': hostname.determine()})
476 except hostname.Error as e:
477 return json_response.error(e), 500
478
479
480@api_blueprint.route('/hostname', methods=['PUT'])

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected