GithubHelp home page GithubHelp logo

drkostas / cloud-filemanager Goto Github PK

View Code? Open in Web Editor NEW
7.0 3.0 1.0 27 KB

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

Home Page: https://pypi.org/project/cloud-filemanager/

License: Apache License 2.0

Makefile 17.76% Python 82.24%
cloud cloud-storage cloud-manager dropbox dropbox-api cloud-file-system

cloud-filemanager's Introduction

Cloud Filemanager

Downloads GitHub license CircleCI

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.

You will need to create an Api key for your Dropbox account. Reference 1, Reference 2

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 cloud_filemanager
$ 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 cloud_filemanager
$ 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 Apache License - see the LICENSE file for details.

Buy Me A Coffee

cloud-filemanager's People

Contributors

drkostas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

maka-77x

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.