Skip to main content

A high-level filemanager utility for cloud services. Currently only Dropbox is supported.

Project description

Cloud Filemanager

CircleCI GitHub license

About

A high-level filemanager utility for cloud services. Currently, only Dropbox is supported. PYPI Package

Table of Contents

Using the library

For a detailed usage example see example.py.

Installing and using the library

First, you need to install the library using pip:

$ pip install cloud_filemanager

Then, import it and initialize it like so:

from cloud_filemanager import DropboxCloudManager

cloud_conf = {'type': 'dropbox', 'config': {'api_key': 'your api key'}}
dbx = DropboxCloudManager(config=cloud_conf)

If you want to use a yml file to load the configuration, you can use the CloudConfig class:

from cloud_filemanager import CloudConfig
import os

config_path = str(os.path.join('confs', 'conf.yml'))
config = CloudConfig(config_src=config_path)
cloud_conf = config.get_cloud_config()

Two example YAML files can be found in the confs folder. For more details on how to use this YAML configuration loader see this Readme.

Examples of usage

The currently supported operations are the following:

  • Upload, Download, Delete Files
  • List directories

Upload

with open('my_file.txt', 'rb') as fp:
    file_to_upload = fp.read()
dbx.upload_file(file_bytes=file_to_upload, upload_path='/tests/my_file.txt', write_mode='overwrite')

Download

dbx.download_file(frompath='/tests/my_file.txt', tofile='my_file_downloaded.txt')

Delete

dbx.delete_file('/tests/my_file.txt')

List Files

dbx.ls('/tests/')

All of these examples can be found in example.py.

Manually install the library

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.

Prerequisites

You need to have a machine with anaconda installed and any Bash based shell (e.g. zsh) installed.

$ conda -V
conda 4.10.1

$ echo $SHELL
/usr/bin/zsh

Install the requirements

All the installation steps are being handled by the Makefile.

First, modify the python version (min_python) and everything else you need in the settings.ini.

Then, execute the following commands:

$ make create_env
$ conda activate yaml_config_wrapper
$ make dist

Now you are ready to use and modify the library.

Run the Unit Tests

If you want to run the unit tests, execute the following command:

$ make tests

Continuous Integration

For the continuous integration, the CircleCI service is being used. For more information you can check the setup guide.

For any modifications, edit the circleci config.

Update PyPI package

This is mainly for future reference for the developers of this project. First, create a file called ~/.pypirc with your pypi login details, as follows:

[pypi]
username = your_pypi_username
password = your_pypi_password

Then, modify the python version (min_python), project status (status), release version (version) and everything else you need in the settings.ini.

Finally, execute the following commands:

$ make create_env
$ conda activate yaml_config_wrapper
$ make release

For a dev release, change the testing_version and instead of make release, run make release_test.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Buy Me A Coffee

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

cloud-filemanager-1.0.1.tar.gz (13.5 kB view details)

Uploaded Source

Built Distribution

cloud_filemanager-1.0.1-py3-none-any.whl (13.1 kB view details)

Uploaded Python 3

File details

Details for the file cloud-filemanager-1.0.1.tar.gz.

File metadata

  • Download URL: cloud-filemanager-1.0.1.tar.gz
  • Upload date:
  • Size: 13.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for cloud-filemanager-1.0.1.tar.gz
Algorithm Hash digest
SHA256 5aeb26639e2ac30d46cb7d608773f39d01308716898da63d034a0c5b1e445cfc
MD5 a148baff64fb5fa46800c42b128cd244
BLAKE2b-256 173f926c860886abcb2fff43ab5ad50a7bd62104a02ca401cc46954f9d9fb5d6

See more details on using hashes here.

File details

Details for the file cloud_filemanager-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: cloud_filemanager-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 13.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for cloud_filemanager-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6bb7111cccdece6a2e1a1c8b25e726af9e70d6fd6f3d8132cec187188479c6a2
MD5 14b0df2fd907737ab219690a7acbb17e
BLAKE2b-256 418010b1b36ff243e4ed8e626886a89ebe17e8791a9f1344f124cb47e5222d6a

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