Config

Module escpos.config

ESC/POS configuration manager.

This module contains the implementations of abstract base class Config.

class escpos.config.Config[source]

Bases: object

Configuration handler class.

This class loads configuration from a default or specified directory. It can create your defined printer and return it to you.

load(config_path=None)[source]

Load and parse the configuration file using pyyaml.

Parameters:

config_path – An optional file path, file handle, or byte string for the configuration file.

Return type:

None

load_yaml_string(yaml_string)[source]

Load and parse a yaml configuration string or file-like object.

Parameters:

yaml_string – A string or file-like object containing yaml formatted configuration.

Return type:

None

printer()[source]

Return a printer that was defined in the config.

Throw an exception on error.

This method loads the default config if one has not been already loaded.