Skip to main content

Pyfilesystem2 over SMB using pysmb

Project description

fs.smbfs star me

Source PyPI Actions Codecov Codacy License Versions Format GitHub issues Downloads Changelog

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, and domain.

Constructor

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

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 to connect with, defaults to "" for anonymous connection.
  • timeout: the timeout, in seconds, for NetBIOS and TCP requests.
  • port: the port the SMB server is listening on.
  • name_port: the port the NetBIOS naming service is listening on.
  • direct_tcp: set to True if the server is accessible directly through TCP, leave as False for maximum compatibility.
  • domain: the network domain to connect with, i.e. the workgroup on Windows. Usually safe to leave as empty string, the default.

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 reproducible situation.

Credits

fs.smbfs is developed and maintained by:

The following people contributed to fs.sshfs:

This project obviously owes a lot to the PyFilesystem2 project and all its contributors.

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-1.0.6.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

fs.smbfs-1.0.6-py2.py3-none-any.whl (15.4 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: fs.smbfs-1.0.6.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for fs.smbfs-1.0.6.tar.gz
Algorithm Hash digest
SHA256 ddeeabd8a8ed25c4dbc85d19950088c69237900fb3ad251879527d628ee6f2f6
MD5 3bb5c3355b1b8f1390b203cc719a6f1d
BLAKE2b-256 f2f1326d0e2ef547484943bea24df2acea0f33a9a683e39a9f52e48e5333cf3f

See more details on using hashes here.

File details

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

File metadata

  • Download URL: fs.smbfs-1.0.6-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.15

File hashes

Hashes for fs.smbfs-1.0.6-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 30ae89ce69ac539c9b6c5fc601f922e6e538658c95ed3bb3922da206b7652006
MD5 6ac7aa5753af132124bdfb2029d25306
BLAKE2b-256 37bc73d692fad16397ccebf1a1e45edc16bab0a4b34c711c910c9c1b63510d2e

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