Welcome to appcore’s documentation!¶
Contents:
Console namespace¶
Terminal utils¶
This is a backport of shutil.get_terminal_size from Python 3.3. The original implementation is in C, but here we use the ctypes and fcntl modules to create a pure Python version of os.get_terminal_size.
-
console.get_terminal_size.
get_terminal_size
(fallback=(80, 24))[source]¶ Get the size of the terminal window. For each of the two dimensions, the environment variable, COLUMNS and LINES respectively, is checked. If the variable is defined and the value is a positive integer, it is used. When COLUMNS or LINES is not defined, which is the common case, the terminal connected to sys.__stdout__ is queried by invoking os.get_terminal_size. If the terminal size cannot be successfully queried, either because the system doesn’t support querying, or because we are not connected to a terminal, the value given in fallback parameter is used. Fallback defaults to (80, 24) which is the default size used by many terminal emulators. The value returned is a named tuple of type os.terminal_size.
Progress Bar Object¶
-
class
console.progress_bar.
ProgressBarOptions
(character_style=(' ', '='), progress_format='{begin_line}{text} {percents_done:>3}% [{filled}{empty}] {value}/{max} {items_per_sec} i/s')[source]¶
Core namespace¶
Configuration object¶
-
class
core.config.
Configuration
(in_memory=False, config_location=None, config_name=None)[source]¶ -
exists
(path)[source]¶ Check for property existence :param path: path to the property with name including :return:
-
get
(path, default=None, check_type=None, module=None)[source]¶ Get option property
Parameters: - path – full path to the property with name
- default – default value if original is not present
- check_type – cast param to passed type, if fail, default will returned
- module – get property from module name
Returns:
-
Net namespace¶
CURL Object¶
-
net.curl.
curl
(url, params=None, auth=None, req_type='GET', data=None, headers=None, timeout=None, use_gzip=True, use_stream=False)[source]¶ Make request to web resource
Parameters: - url – Url to endpoint
- params – list of params after ”?”
- auth – authorization tokens
- req_type – column_type of the request
- data – data which need to be posted
- headers – headers which would be posted with request
- timeout – Request timeout
- use_gzip – Accept gzip and deflate response from the server
- use_stream – Do not parse content of response ans stream it via raw property
:return Response object
:type url str :type params dict :type auth CURLAuth :type req_type str :type headers dict :type timeout int :type use_gzip bool :type use_stream bool :rtype CURLResponse
-
class
net.curl.
CURLResponse
(director_open_result, is_stream=False)[source]¶ -
code
¶ Returns: HTTP Request Response code
-
content
¶ Returns: Text content of the response (unzipped and decoded)
-
from_json
()[source]¶ Returns: Return parsed json object from the response, if possible. If operation fail, will be returned None :rtype dict
-
headers
¶ Returns: HTTP Response Headers
-
raw
¶ Returns: Raw content of the response
-