semvec/pypi-packages huggingface dataset:
collectiondbf 1.1.7
Download all files in a Blackfynn collection via command line or gui
Requires Python: >=3.5

# collectiondbf 
[![PyPI version](https://badge.fury.io/py/collectiondbf.svg)](https://badge.fury.io/py/collectiondbf)
[![Maintainability](https://api.codeclimate.com/v1/badges/3142677487dbf6ff656b/maintainability)](https://codeclimate.com/github/Tehsurfer/collectiondbf/maintainability)

### Collection Downloads from BlackFynn 

A python tool for downloading a collection of files from Blackfynn. Can be run from command line or enter input in a UI

## Installation 

#### Windows
`pip install collectiondbf`

#### Linux 
```
sudo apt-get install python3-tk
pip3 install collectiondbf
```

#### MacOS
`pip install collectiondbf`

*_Note that since macOS python does not come with tkinter, only command line usage is supported._

_collectiondbf requires python 3.3+ and tkinter to run_

# Usage

## Command Line

### Downloading Collections
The commands below will download the desired directory at the command prompts location.
```
python -m collectiondbf <collection:ID> [api-key] [api-secret] [--recursive]
```

Add the `--recursive` option if you wish to download all nested directories under the given location

If you cannot find the collection ID for the folder you wish to download, check for it in the url like so:

![collectionID](https://user-images.githubusercontent.com/37255664/64832679-fe039c80-d62e-11e9-96db-38a54cbd6c55.jpg)

Alternatively check out [_this 50s video tutorial_](https://drive.google.com/file/d/1sZMIx8SsEygwtRhLSu_O5wT0Ql0-UJDx/view?usp=sharing) on how to find collection ID and API keys in Blackfynn

**NOTE** You only have to input your keys once! collectiondbf will save them for you for subsequent downloads!

### Downloading Datasets
Downloading datasets works exactly the same as downloading collections! Just put the dataset ID in place of the collection ID
```
python -m collectiondbf <dataset:ID> [api-key] [api-secret] [--recursive]
```


## User Interface
Running `python -m collectiondbf`will start the following ui to input keys and collection ID
![select_channel_2019-09-13 16-24-58 (2)](https://user-images.githubusercontent.com/37255664/64837534-1a113900-d643-11e9-9ba7-3cd37ca74151.jpg)

## Using config.py for regular usage 

Set environment variables to your Blackfynn keys
```
BLACKFYNN_API_TOKEN=xxxxx-xxxxx-xxxxx
BLACKFYNN_API_SECRET=xxxxx-xxxxx-xxxxx
```
_or_

Edit config.py to your keys:

_config.py_
```
import os
API_TOKEN = 'xxxxx-xxxxx-xxxx'
API_SECRET = 'xxxxx-xxxxx-xxxxx'
```