opihiexarata.library.http module
Functions and methods which allow for ease of interacting with web based resources. Included here are functions which download files, query web resources and other things. This interacts mostly with HTTP based services.
- opihiexarata.library.http.api_request_sleep(seconds: float = None) None [source]
Sleep for the time, specified in the configuration file, for API requests. This function exists to ensure uniformity in application.
- Parameters:
seconds (float, default = None) – The number of seconds that the program should sleep for. If not provided, then it defaults to the configuration value.
Results –
------- –
None –
- opihiexarata.library.http.download_file_from_url(url: str, filename: str, overwrite: bool = False) None [source]
Download a file from a URL to disk.
..warning:: The backend of this function relies on a function which may be depreciated in the future. This function may need to be rewritten.
- Parameters:
url (string) – The url which the file will be downloaded from.
filename (string) – The filename where the file will be saved.
overwrite (bool, default = False) – If the file already exists, overwrite it. If False, it would raise an error instead.