facile_rs.utils.http¶
Module Contents¶
Functions¶
Fetch files from local locations or from URLs and save them at the given path. |
|
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 data from a JSON or YAML file and return it as a dictionary. |
|
Fetch JSON data from the given location. |
|
Check if a location is remote |
Data¶
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, headers={})¶
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, params)¶
Fetch JSON data from the given location.
- Parameters:
location (str) – URL to the JSON data
params – dict
- Returns:
JSON-encoded response
- is_remote(location)¶
Check if a location is remote
- Parameters:
location – URL to the JSON data
- Returns:
bool