utils module

utils.change_ttw(x)

Math function which creates next time to wait (ttw)

Args:
x (int): number of checks
Returns:
time to wait
utils.checker(method, data, only_status=True)

Generic function which create task and returns its id

Args:
method: Name of method specified in settings data (str): String which will be concatenated with url
Kwargs:
only_status(bool): parameter to set up only status from json or whole json
Returns:
status (str): Status of task: “ok”, “fail”, “error” json (dict): Whole json data
utils.creator(method, data, **kwargs)

Generic function which create task and returns its id

Args:
method: The name of method specified in settings data (str): String which will be concatenated with url
Kwargs:
**kwargs: Additional parameters used in requests
Returns:
task_id (str): UUID4 task id
utils.get_json(method, data, **kwargs)

Shortcut to get json from request

Args:
method: The name of method specified in settings data (str): String which will be concatenated with url
Kwargs:
**kwargs: Additional parameters used in requests
Returns:
dict object
utils.get_request(method, data, **kwargs)

Send http get request on url specified in settings

Args:
method: The name of method specified in settings data (str): String which will be concatenated with url
Kwargs:
**kwargs: Additional parameters used in requests
Returns:
request object
utils.unzip(filename, path='.')

Function to unzip file in specific path

Args:
filename: The name of file to unzip path: The directory in which this file should be unzipped
Returns:
None
utils.wait_until_task(task_id, checker, getter, *args)

Function which waits until task is done and send output futher

Args:

task_id: Id of task which was given by RESTful API checker: Function which checks the status.

Created via generic “checker” function
getter: Function which gets results.
Created via generic “getter” function

*args: Other arguments used in getter function

Returns:
None if error Results from getter