Skip to main content

FTP filesystem for PyFilesystem2

Project description

miarec_ftpfs

Actions

MiaRec FTPFS is a PyFilesystem interface to FTP/FTPS storage.

This a fork of the builtin FTPFS class from PyFileSystem2 project, written by Will McGugan (email willmcgugan@gmail.com).

The code was modified by MiaRec team to fullfill our needs.

Notable differences between miarec_ftpfs.FTPFS and fs.FTPFS

  1. Requires Python 3.6+. A support of Python 2.7 is removed.

  2. Opener protocol prefixes are mftp:// and mftps:// for FTP and FTP-over-TLS respectively (instead of the original ftp:// and ftps://)

  3. Add Implicit TLS support

  4. Fix bugs in Explicit TLS implementation

  5. Automatically try to re-open FTP connection on the next operation in case of network issues. Previously, the FTPFS object was stuck in error state, and any operations on the file system instance, like openbin(), listdir(), etc, were failing infinitely.

  6. Better error handling. All FTP protocol-specific and SSL errors are converted into corresponding FSError exception

Installing

You can install FTPFS from pip as follows:

pip install miarec_ftpfs

This will install the most recent stable version.

Alternatively, if you want the cutting edge code, you can check out the GitHub repos at https://github.com/miarec/miarec_ftpfs

Opening a FTPFS

Open an FTPFS by explicitly using the constructor:

from fs.ftpfs import FTPFS
FTPFS("demo.wftpserver.com")

Or via an FS URL:

ftp_fs = fs.open_fs('mftp://test.rebex.net')

Or via an FS URL, using TLS:

ftp_fs = fs.open_fs('mftps://demo.wftpserver.com')

You can also use a non-anonymous username, and optionally a password, even within a FS URL:

ftp_fs = FTPFS("test.rebex.net", user="demo", passwd="password")
ftp_fs = fs.open_fs('mftp://demo:password@test.rebex.net')

Connecting via a proxy is supported. If using a FS URL, the proxy URL will need to be added as a URL parameter:

ftp_fs = FTPFS("ftp.ebi.ac.uk", proxy="test.rebex.net")
ftp_fs = fs.open_fs('mftp://ftp.ebi.ac.uk/?proxy=test.rebex.net')

Testing

Automated unit tests are run on GitHub Actions

To run the tests locally, do the following.

Create activate python virtual environment:

python -m vevn venv
source venv\bin\activate

Install the project and test dependencies:

pip install -e ".[test]"

Run tests:

pytest

Documentation

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

miarec_ftpfs-2024.3.1.tar.gz (24.0 kB view details)

Uploaded Source

Built Distribution

miarec_ftpfs-2024.3.1-py2.py3-none-any.whl (17.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file miarec_ftpfs-2024.3.1.tar.gz.

File metadata

  • Download URL: miarec_ftpfs-2024.3.1.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.2

File hashes

Hashes for miarec_ftpfs-2024.3.1.tar.gz
Algorithm Hash digest
SHA256 064b7841ce7c21b6b8f90b60e5324193b17bd6830dcb97183716b4bf5cc56582
MD5 c49ac402964ecc0fcbde13d998de10a2
BLAKE2b-256 da3f67369b3ef7a82cea6ed70f46f46b65d6665743f646ee8863f150fb510274

See more details on using hashes here.

File details

Details for the file miarec_ftpfs-2024.3.1-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for miarec_ftpfs-2024.3.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 ea87ccc03616033d27201c8f6056f54719667c13265bd82613739d94b887d2d5
MD5 b7ddcfb00a8c86d710d2f53d12f7738f
BLAKE2b-256 6e13a79e1df253b0a89ab7cbaecafa0d1663b3e0f9a1b62e6dea435afe72567d

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