facile_rs.utils.http

Module Contents

Functions

fetch_files

Fetch files from local locations or from URLs and save them at the given path.

fetch_file

Fetch one file from a local location or an URL and save them at the given path. If no file_name is provided it will be created from the location

fetch_dict

Fetch data from a JSON or YAML file and return it as a dictionary.

fetch_json

Fetch JSON data from the given location.

Data

logger

API

logger = 'getLogger(...)'
fetch_files(locations, path, headers={}, overwrite=False)

Fetch files from local locations or from URLs and save them at the given path.

Parameters:
  • locations (list of str) – list of URL or paths to the files

  • path (str) – path where the files should be saved

fetch_file(location, path, file_name=None, headers={}, overwrite=False)

Fetch one file from a local location or an URL and save them at the given path. If no file_name is provided it will be created from the location

Parameters:
  • location – URL or path to the file

  • path (str) – path where the file should be saved

  • file_name – name of the file

fetch_dict(location)

Fetch data from a JSON or YAML file and return it as a dictionary.

Parameters:

location (str) – URL or path to the file (allowed extensions: .json, .yml, .yaml)

Returns:

Dictionary containing file data

Return type:

dict

fetch_json(location)

Fetch JSON data from the given location.

Parameters:

location (str) – URL to the JSON data

Returns:

JSON-encoded response