Utility
Utility module for autopylot. This module contains utility functions.
Examples:
>>> import autopylot as utility
>>> utility.pause_program(seconds=5)
>>> utility.api_request(url="https://catfact.ninja/fact?max_length=140")
>>> utility.clear_output()
>>> utility.install_module(module_name="requests")
>>> utility.uninstall_module(module_name="requests")
>>> utility.get_module_version(module_name="requests")
>>> utility.image_to_text(image_path="image.png")
This module contains the following functions:
pause_program(seconds)
: Pauses the program for the specified number of secondsapi_request(url , method, body, headers)
: Makes an API request to the specified URLclear_output()
: Clears the output of the consoleinstall_module(module_name)
: Installs the specified moduleuninstall_module(module_name)
: Uninstalls the specified moduleget_module_version(module_name)
: Gets the version of the specified moduleimage_to_text(image_path)
: Converts the specified image to text
api_request(url, method='GET', body=None, headers=None)
Makes an API request to the specified URL
Parameters:
Name | Type | Description | Default |
---|---|---|---|
url |
str
|
URL to make request to |
required |
method |
str
|
HTTP method to use for the request. Available options are "GET", "POST", "PUT", "DELETE". |
'GET'
|
body |
dict
|
Body of the request. |
None
|
headers |
dict
|
Headers of the request. |
None
|
Returns:
Name | Type | Description |
---|---|---|
response |
dict
|
Response from the API |
Examples: