libb.file_share_session

class file_share_session(host, password, drive, share)[source]

Bases: object

Context manager for temporarily mounting a file share.

Mounts share before commands and unmounts on exit.

Parameters:
  • host (str) – Remote host name or IP.

  • password (str) – Password for authentication.

  • drive (str) – Local drive letter to mount to.

  • share (str) – Remote share name.

Example:

with shell.file_share_session(host, password, 'Z:', 'data'):
    for cmd in commands:
        out = shell.run_command(cmd)