Downloading

This module has tools for making packages that can reproducibly download and parse data.

bio2bel.downloading.make_downloader(url, path)[source]

Make a function that downloads the data for you, or uses a cached version at the given path.

Parameters
  • url (str) – The URL of some data

  • path (str) – The path of the cached data, or where data is cached if it does not already exist

Return type

Callable[[bool], str]

Returns

A function that downloads the data and returns the path of the data

bio2bel.downloading.make_json_getter(data_url, data_path)[source]

Build a function that handles downloading JSON data and parsing it.

Parameters
  • data_url (str) – The URL of the data

  • data_path (str) – The path where the data should get stored

bio2bel.downloading.make_df_getter(data_url, data_path, **kwargs)[source]

Build a function that handles downloading tabular data and parsing it into a pandas DataFrame.

Parameters
  • data_url (str) – The URL of the data

  • data_path (str) – The path where the data should get stored

  • kwargs – Any other arguments to pass to pandas.read_csv()

Return type

Callable[[Optional[str], bool, bool], DataFrame]

bio2bel.downloading.make_zipped_df_getter(data_url, data_path, zip_path, **kwargs)[source]

Build a function that handles downloading data inside a zip folder and parsing it into a pandas DataFrame.

Parameters
  • data_url (str) – The URL of the data

  • data_path (str) – The path where the data should get stored

  • zip_path (str) – The path to the data inside the zip folder

  • kwargs – Any other arguments to pass to pandas.read_csv()