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

Function paste_post

app/api.py:837–860  ·  view source on GitHub ↗

Pastes text onto the target machine. Expects a JSON data structure in the request body that contains the following parameters: - text: string - language: string as an IETF language tag Example of request body: { "text": "Hello, World!", "language": "en-US"

()

Source from the content-addressed store, hash-verified

835@api_blueprint.route('/paste', methods=['POST'])
836@required_auth(auth.Role.OPERATOR)
837def paste_post():
838 """Pastes text onto the target machine.
839
840 Expects a JSON data structure in the request body that contains the
841 following parameters:
842 - text: string
843 - language: string as an IETF language tag
844
845 Example of request body:
846 {
847 "text": "Hello, World!",
848 "language": "en-US"
849 }
850 """
851 try:
852 keystrokes = request_parsers.paste.parse_keystrokes(flask.request)
853 except request_parsers.errors.Error as e:
854 return json_response.error(e), 400
855
856 keyboard_path = env.KEYBOARD_PATH
857 execute.background_thread(fake_keyboard.send_keystrokes,
858 args=(keyboard_path, keystrokes))
859
860 return json_response.success()

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected