x2gobroker.brokers.inifile_broker module

x2gobroker.brokers.inifile_broker.X2GoBroker class - a simple X2GoBroker implementations that uses text-based config files (also supports load balancing)

class x2gobroker.brokers.inifile_broker.X2GoBroker(profile_config_file=None, profile_config_defaults=None, **kwargs)[source]

Bases: x2gobroker.brokers.base_broker.X2GoBroker

x2gobroker.brokers.inifile_broker.X2GoBroker implements a broker backend retrieving its session profile and ACL configuration from a file in INI file format.

backend_name = 'inifile'
get_profile(profile_id)[source]

Get the session profile for profile ID <profile_id>.

With the inifile broker backend, the session profile parameters are the given <parameter>=<value> pairs under the section [<profile_id>].

Parameters

profile_id (str) – the ID of a profile

Returns

a dictionary representing the session profile for ID <profile_id>

Return type

dict

get_profile_acls(profile_id)[source]

Get the ACLs for session profile with profile ID <profile_id>.

With the inifile broker backend, these ACL specific options are <param>=<value> pairs prefixed like this: acl-<param>=<value>

Parameters

profile_id (str) – the ID of a profile

Returns

a dictionary representing the ACLs for session profile with ID <profile_id>

Return type

dict

get_profile_broker(profile_id)[source]

Get broker-specific session profile options from the session profile with profile ID <profile_id>.

With the inifile broker backend, these broker specific options are <param>=<value> pairs prefixed like this: broker-<param>=<value>

Parameters

profile_id (str) – the ID of a profile

Returns

a dictionary representing the session profile for ID <profile_id>

Return type

dict

get_profile_defaults()[source]

Get the session profile defaults, i.e. profile options that all configured session profiles have in common.

The defaults are hard-coded in x2gobroker.defaults for class x2gobroker.brokers.base_broker.X2GoBroker. With the inifile backend, they can be overridden/customized under the INI file’s [DEFAULT] section.

Returns

a dictionary containing the session profile defaults

Return type

dict

get_profile_ids()[source]

Retrieve the complete list of session profile IDs.

With the inifile broker backend, the profile IDs are the names of the INI file’s sections.

Returns

list of profile IDs

Return type

list