Skip to content
/ dropit Public

Console utility to get/put file from/to dropbox

Notifications You must be signed in to change notification settings

mnogom/dropit

Repository files navigation

DROP IT!

GET and PUT file to your Dropbox


Build/Linter and Maintainability badges:

Python package Maintainability


Installation

pip3 install --upgrade git+https://github.com/mnogom/dropit.git

Usage

  1. From command line
% dropit --help


usage: dropit [-h] {put,get,logout} ...

Get/Put file from/to Dropbox

positional arguments:
  {put,get,logout}
    put             Put local file to Dropbox
    get             Get file from Dropbox to local storage
    logout          Remove all user tokens

optional arguments:
  -h, --help        show this help message and exit
% dropit put --help


usage: dropit put [-h] [-f] [-s] src_path dest_path

Put local file to Dropbox

positional arguments:
  src_path     Source file path
  dest_path    Destination file path

optional arguments:
  -h, --help   show this help message and exit
  -f, --force  force update file (rewrite file if it already exists)
  -s, --share  get url for file from Dropbox. Be careful. File would be visible for everyone
% dropit get --help


usage: dropit get [-h] [-f] src_path dest_path

Get file from Dropbox to local storage

positional arguments:
  src_path     Source file path
  dest_path    Destination file path

optional arguments:
  -h, --help   show this help message and exit
  -f, --force  force update file (rewrite file if it already exists)
% dropit logout --help


usage: dropit logout [-h]

Remove all user tokens

optional arguments:
  -h, --help  show this help message and exit
  1. From python
import dropit

# Put file to Dropbox
dropit.put_file("local/file/path", "dropbox/file/path", force=True)
# Get file from Dropbox
dropit.get_file("dropbox/file/path", "local/file/path")
# Remove all tokens from cache
dropit.logout_app()
  1. Copy repository
  • clone repository from github
git clone git@github.com:mnogom/dropit.git
  • go to project directory
cd dropit
  • setup env. Uses poetry. Be sure you have it.
pip install --upgrade poetry --user
make install
  • to check virtural env
poetry env list --full-path

~/<path>/<to>/<project>/dropit/.venv (Activated)
  • to be sure that all works try to start tests. Tests will work after first run script.
make test

tests/test_drop.py::test_drops[text.txt] PASSED                          [ 25%]
tests/test_drop.py::test_drops[flower.jpg] PASSED                        [ 50%]
tests/test_drop.py::test_drops[task.jpg] PASSED                          [ 75%]
tests/test_drop.py::test_app_check PASSED                                [100%]

Features

  1. Validate and auto-update token
  2. Can get a file from Dropbox
  3. Can put a file to Dropbox
  4. Can use force (overwrite a local file or in Dropbox)
  5. Can share an uploaded file. Url will be in console and your clipboard
  6. Check extensions of files
  7. Remove all user tokens. This is only one method to protect you Dropbox account

How to

  1. At first launch you will need to create access_token. It will be saved in home_directory/.dropit_cache/.user_tok ens.json in unencrypted format. Don't forget to logout [6] if you want to protect your account

asciicast

  1. If you put the file that already exists you will have an error. But you can use -f / --force flag to rewrite file

asciicast

  1. Util check extensions of files

asciicast

  1. Put and share file to the World

asciicast

  1. Get file from Dropbox

asciicast

  1. Logout

asciicast

About

Console utility to get/put file from/to dropbox

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published