Skip to content

Commit

Permalink
dataset download fix (#433)
Browse files Browse the repository at this point in the history
* Add possibility to have non-http downloaders; keeping certificate check off in http downloaders (not suggested)

* [pre-commit.ci] auto fixes from pre-commit.com hooks

* Update whats_new.rst

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bru <a.bruno@aluno.ufabc.edu.br>
  • Loading branch information
3 people committed Aug 10, 2023
1 parent 5bab7d6 commit fcc1abf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/source/whats_new.rst
Expand Up @@ -61,6 +61,7 @@ Bugs
- Fix :func:`moabb.paradigms.base.BaseParadigm` using attributes before defining them (PR :gh:`408`, issue :gh:`425` by `Pierre Guetschel`_)
- Fix :func:`moabb.paradigms.FakeImageryParadigm`, :func:`moabb.paradigms.FakeP300Paradigm` and :func:`moabb.paradigms.FakeSSVEPParadigm` ``is_valid`` methods to only accept the correct datasets (PR :gh:`408` by `Pierre Guetschel`_)
- Fix ``dataset_list`` construction, which could be empty due to bad import order (PR :gh:`449` by `Thomas Moreau`_).
- Fixing dataset downloader from servers with non-http (PR :gh:`433` by `Sara Sedlar`_)

API changes
~~~~~~~~~~~
Expand Down
7 changes: 5 additions & 2 deletions moabb/datasets/download.py
Expand Up @@ -12,7 +12,8 @@
from mne import get_config, set_config
from mne.datasets.utils import _get_path
from mne.utils import _url_to_local_path, verbose
from pooch import HTTPDownloader, file_hash, retrieve
from pooch import file_hash, retrieve
from pooch.downloaders import choose_downloader
from requests.exceptions import HTTPError


Expand Down Expand Up @@ -139,7 +140,9 @@ def data_dl(url, sign, path=None, force_update=False, verbose=None):
table = {ord(c): "-" for c in ':*?"<>|'}
destination = Path(str(path) + destination.split(str(path))[1].translate(table))

downloader = HTTPDownloader(verify=False)
downloader = choose_downloader(url, progressbar=True)
if type(downloader).__name__ in ["HTTPDownloader", "DOIDownloader"]:
downloader.kwargs.setdefault("verify", False)

# Fetch the file
if not destination.is_file() or force_update:
Expand Down

0 comments on commit fcc1abf

Please sign in to comment.