facile_rs.utils.http

Module Contents

Functions

fetch_files

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

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={})

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

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

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

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