pygbif icon indicating copy to clipboard operation
pygbif copied to clipboard

add progress bar to download_get

Open dluks opened this issue 1 year ago • 1 comments

I added a simple tqdm progress bar to the gbif_GET_write function as a quality-of-life improvement.

Description

I often need to download large files from GBIF and have wished I could see the progress. This addresses that. I don't know what the sentiment is toward requirements on this project, so I hope the inclusion of tqdm isn't against principle.

Example

import pygbif.occurences as occ

occ.download_get("0000066-140928181241064")
INFO:Download file size: 143097 bytes
100%|██████████| 143k/143k [00:00<00:00, 1.14MB/s]
INFO:On disk at [./0000066-140928181241064.zip](https://file+.vscode-resource.vscode-cdn.net/Users/dluks/local_projects/pygbif/0000066-140928181241064.zip)
{'path': './0000066-140928181241064.zip',
 'size': 143097,
 'key': '0000066-140928181241064'}

All tests continue to pass, but, given the minimal testing of download_get at present, I didn't add anything. I'm not exactly sure how I'd test this anyway 🤔 .

dluks avatar Jan 19 '24 11:01 dluks

When adding tqdm to setup.py, I noticed that black formatting hadn't been applied. Commit 48d45a6 includes that.

dluks avatar Jan 21 '24 16:01 dluks