Reference

Main Class

Most interactions with ghau will be done through the main Update class. Details regarding it can be found below:

class ghau.Update(version: str, repo: str, pre_releases: bool = False, reboot: str = None, download: str = 'zip', asset: str = None, auth: str = None, ratemin: int = 20, boot_check: bool = True, success_func=None, fail_func=None, pre_update_func=None, fail_args=None, success_args=None, post_update_func=None, pre_update_args=None, post_update_args=None)

Main class used to trigger updates through ghau.

Parameters:
  • version (str) – local version to check against online versions.
  • repo (str) – github repository to check for updates in. Must be publicly accessible unless you are using a Github Token.
  • pre-releases (bool, optional) – accept pre-releases as valid updates, defaults to False.
  • reboot (str, optional) – command intended to reboot the program after a successful update installs.
  • download (str, optional) – the type of download you wish to use for updates. Either “zip” (source code) or “asset” (uploaded files), defaults to “zip”.
  • asset (str, optional.) – name of asset to download when set to “asset” mode.
  • auth (str, optional) – authentication token used for accessing the Github API, defaults to None.
  • ratemin (int, optional.) – minimum amount of API requests left before updates will stop, defaults to 20. Maximum is 60/hr for unauthorized requests, and 5000 for authorized requests.
restart()

Restarts the program

update()

Check for updates and install if an update is found.

All expected exceptions triggered during the run of this method are automatically handled. They are intentionally raised to stop the update process should it be needed, not the entire program.

An error message will be printed to the console summarizing what occurred when this happens.

Raises:ghau.errors.InvalidDownloadTypeError – an unexpected value was given to the download parameter of ghau.update.Update.
update_check()

Returns True if an update is available to download.

wl_files(*args)

Add files to the whitelist. This protects any listed files from deletion during update installation. Each file should be a string referring to its name.

Parameters:args (str) – list of files to protect.
wl_test()

Test the whitelist and output what’s protected.

Useful for testing your whitelist configuration.

Reboot Functions

There are also a few added functions to make rebooting easier.

These functions build the reboot command for you to place in the reboot parameter of ghau.Update. They also provide ghau the ability to stop Update Loops.

Because of this, it is highly recommended you utilize these functions if you are rebooting.

ghau.python(file: pathlib.Path) → str

Builds the command required to run the given python file if it is in the current working directory.

Useful for building the command to place in the reboot parameter of ghau.update.Update.

This is the recommended way to reboot into a python file, as it adds an argument ghau detects to stop update loops. This will also ensure the file given is a python script.

See also: ghau.update.exe(), ghau.update.cmd()

Raises:ghau.errors.FileNotScriptError – raised if the given file is not a python script.
ghau.exe(file: str) → str

Added for consistency with ghau.update.python.

Useful for building the command to place in the reboot parameter of ghau.update.Update.

This is the recommended way to reboot into an executable file, as it adds an argument ghau detects to stop update loops. This will also ensure the file given is an .exe file.

See also: ghau.update.python(), ghau.update.cmd()

Raises:ghau.errors.FileNotExeError – raised if the given file is not an executable.
ghau.cmd(command: str) → str

Added for consistency with ghau.update.python.

Useful for building the command to place in the reboot parameter of ghau.update.Update.

This is the recommended way to reboot using a command, as it adds an argument ghau detects to stop update loops.

See also: ghau.update.python(), ghau.update.exe()