Skip to main content

SMB protocol wrapper for python

Project description

smbio

SMB protocol wrapper for python

Installation

pip install smbio

Usage

import smbio

connector = smbio.Connector(
    url=r"\\localhost\Share",
    username="Username",
    password="StrongPa$$w0rd"
)

with (
    connector.connect() as conn,
    connector.mount(conn) as session,
    connector.tree(session) as tree,
    connector.open(tree, r"Directory\Subdirectory") as directory
):
    files = smbio.glob(connector, directory, recurse=False)
    for out in files:
        if out.is_directory:
            continue
        
        with (
            open(smbio.Path(out.path), mode="rb") as inp_file,
            connector.open(tree, out.path) as out_file
        ):
            out_file.write(inp_file.read())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

smbio-0.1.0.tar.gz (4.1 kB view hashes)

Uploaded Source

Built Distribution

smbio-0.1.0-py3-none-any.whl (5.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page