mokr.download
Attributes
Functions
|
Small utility to get different URL for MacOS Silicon machines. |
|
Download browser from the given |
|
Get path of the system target browser binary. |
|
Ensure the target browser exists on this machine. |
|
Install browser from dmg file. Mounts the dmg and copies to target path. |
|
Extract given loaded zip file to target |
|
Download and extract binary. |
Module Contents
- mokr.download.CHROME_DL_HOST
- mokr.download.FIREFOX_DL_HOST
- mokr.download.CR_DOWNLOAD_URLS
- mokr.download.FF_DOWNLOAD_URLS
- mokr.download.CR_BINARY_NAMES
- mokr.download.FF_BINARY_NAMES
- mokr.download.CR_BINARY_PATHS
- mokr.download.FF_BINARY_PATHS
- mokr.download.get_platform() str
Small utility to get different URL for MacOS Silicon machines.
- mokr.download.download_zip(browser_type: str, url: str) io.BytesIO
Download browser from the given
url.- Parameters:
browser_type (str) – Target browser type, of “chrome” or “firefox”.
url (str) – URL to download from.
- Raises:
requests.HTTPError – Raised if response is bad (status code over 399).
- Returns:
The browser content as a BytesIO object.
- Return type:
BytesIO
- mokr.download.browser_binary(browser_type: str) pathlib.Path
Get path of the system target browser binary.
- Parameters:
browser_type (str) – Target browser type, of “chrome” or “firefox”.
- Returns:
Browser binary Path object.
- Return type:
Path
- mokr.download.ensure_binary(browser_type: str) bool
Ensure the target browser exists on this machine.
- Parameters:
browser_type (str) – Target browser type, of “chrome” or “firefox”.
- Returns:
True if binary exists, otherwise False.
- Return type:
bool
- mokr.download.install_dmg(process_bar: tqdm.tqdm, dmg_path: str, dest_path: pathlib.Path) None
Install browser from dmg file. Mounts the dmg and copies to target path.
- Parameters:
process_bar (tqdm) – A process bar to update as actions occur.
dmg_path (str) – Path to dmg file.
dest_path (Path) – Path to final directory.
- Raises:
OSError – Raised if mount fails.
FileNotFoundError – Raised if dmg contains no .app files.
- mokr.download.extract(browser_type: str, data: io.BytesIO, path: pathlib.Path, url: str) None
Extract given loaded zip file to target
path.- Parameters:
browser_type (str) – Target browser type, of “chrome” or “firefox”.
data (BytesIO) – Zip file as BytesIO.
path (Path) – Destination path to extract to.
url (str) – Download URL the file came from.
- Raises:
IOError – Raised if an unhandled error occurs and the browser simply doesn’t end up extracted to the target.
- mokr.download.install_binary(browser_type: str) None
Download and extract binary.
- Parameters:
browser_type (str) – Target browser type, of “chrome” or “firefox”.