# pyinfra.api.connectors.local module

`pyinfra.api.connectors.local.``connect`(state, host, **kwargs)

`pyinfra.api.connectors.local.``put_file`(state, host, file_io, remote_file, sudo=False, sudo_user=None, su_user=None, print_output=False)

`pyinfra.api.connectors.local.``run_shell_command`(state, host, command, sudo=False, sudo_user=None, su_user=None, preserve_sudo_env=False, get_pty=False, env=None, timeout=None, print_output=False)

  Execute a command on the local machine.

  Parameters:

  - state (`pyinfra.api.State` obj) – state object for this command
  - hostname (string) – hostname of the target
  - command (string) – actual command to execute
  - sudo (boolean) – whether to wrap the command with sudo
  - sudo_user (string) – user to sudo to
  - get_pty (boolean) – whether to get a PTY before executing the command
  - env (dict) – envrionment variables to set
  - timeout (int) – timeout for this command to complete before erroring

  Returns: | (exit_code, stdout, stderr) stdout and stderr are both lists of strings from each buffer.
  Return type: | tuple