Skip to main content

Pyfilesystem2 over SMB using pysmb

Project description

Source PyPI Travis Codecov Codacy Format License

Requirements

pyfilesystem2

PyPI fs

Source fs

License fs

six

PyPI six

Source six

License six

pysmb

PyPI pysmb

Source pysmb

License pysmb

Installation

Install directly from PyPI, using pip

pip install fs.smbfs

Usage

Opener

Use fs.open_fs to open a filesystem with an SMB FS URL:

import fs
smb_fs = fs.open_fs('smb://username:password@SAMBAHOSTNAME:port/share')

The opener can use either an IPv4 address or a NetBIOS hostname, using the NetBIOS name service to find the other token. Otherwise, if NetBIOS is not available, a new SMB connection can be established by using the IPv4 address and giving the hostname with the hostname URL parameter.

The following parameters can be passed as URL parameters: timeout, name-port, direct-tcp, hostname.

Constructor

import fs.smbfs
smb_fs = fs.smbfs.SMBFS(
    host, username='guest', passwd='', timeout=15,
    port=139, name_port=137, direct_tcp=False
)

with each argument explained below:

host

either the host name (not the FQDN) of the SMB server, its IP address, or both in a tuple. if either the IP address or the host name is not given, NETBIOS is queried to get the missing data.

user

the username to connect with, defaults to ‘guest’ for anonymous connection.

passwd

an optional password, defaults to ‘’ for anonymous connection.

timeout

the timeout, in seconds, for NetBIOS and TCP requests.

port

the port the SMB server is listening on.

naming_port

the port the NetBIOS naming service is listening on

direct_tcp

set to True if the server is accessible directly through TCP, leave to False for maximum compatibility

Once created, the SMBFS filesystem behaves like any other filesystem (see the Pyfilesystem2 documentation), except if it was open in the root directory of the server, in which case the root directory of the SMBFS instance will be read-only (since SMB clients cannot create new shares).

Feedback

Found a bug ? Have an enhancement request ? Head over to the GitHub issue tracker of the project if you need to report or ask something. If you are filling in on a bug, please include as much information as you can about the issue, and try to recreate the same bug in a simple, easily reproductible situation.

See also

  • fs, the core Pyfilesystem2 library

  • fs.archive, enhanced archive filesystems for Pyfilesystem2

  • fs.sshfs, Pyfilesystem2 over SSH using paramiko

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

fs.smbfs-0.7.4.tar.gz (14.5 kB view details)

Uploaded Source

Built Distribution

fs.smbfs-0.7.4-py2.py3-none-any.whl (13.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file fs.smbfs-0.7.4.tar.gz.

File metadata

  • Download URL: fs.smbfs-0.7.4.tar.gz
  • Upload date:
  • Size: 14.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.1

File hashes

Hashes for fs.smbfs-0.7.4.tar.gz
Algorithm Hash digest
SHA256 1550abc39970e6beb0027829b61dfa92de7a38422e2144059925b4c0ffb6cb1c
MD5 2cd26f1dc38dbe8c1107577a99752f79
BLAKE2b-256 d72442b14f1b430d2fdc1f8ec31b3672000cb496791e6b840737068188c44eaa

See more details on using hashes here.

File details

Details for the file fs.smbfs-0.7.4-py2.py3-none-any.whl.

File metadata

  • Download URL: fs.smbfs-0.7.4-py2.py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.1

File hashes

Hashes for fs.smbfs-0.7.4-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 b79913e16fa2f9bc6b42142db04d3be4c2f53249f43fd596a750e752651a1541
MD5 6f19ac68be6163c4d1962a8f9da25265
BLAKE2b-256 a48fb88a1bdea5ba934c6574d0eeed695161207a36a1e2acf07359a96106fcc9

See more details on using hashes here.

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