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.
()
| 458 | @api_blueprint.route('/hostname', methods=['GET']) |
| 459 | @required_auth(auth.Role.ADMIN) |
| 460 | def 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']) |
nothing calls this directly
no outgoing calls
no test coverage detected