Skip to content

Environment Variables

This module provides access to environment variables available in KNIME.

class knime.extension.ProxySettings

Proxy settings for a KNIME node

The proxy settings are used to set the proxy environment variables for the KNIME Python integration.

Parameters
  • protocol_name : str — The name of the protocol. Default is None.
  • host_name : str — The name of the host. Default is None.
  • port_number : str — The port number. Default is None.
  • exclude_hosts : str — List of hosts to exclude. Default is None.
  • user_name : str — The username. Default is None.
  • password : str — The password. Default is None.
method __init__(protocol_name: Optional[str] = None, host_name: Optional[str] = None, port_number: Optional[str] = None, exclude_hosts: Optional[str] = None, user_name: Optional[str] = None, password: Optional[str] = None)

Initialize a connection object with optional parameters.

method create_proxy_environment_key_value_pair() → Tuple[str, str]

Create the proxy environment variable strings.

Returns

Tuple[str, str]: The proxy environment variable name and value

attribute exclude_hosts : Optional[str]
classmethod from_dict(proxy_dict)

Create a ProxySettings object from a dictionary.

Parameters
  • proxy_dict : dict — The dictionary containing the proxy settings.
Returns

ProxySettings — The proxy settings object.

classmethod from_string(proxy_string, exclude_hosts: Optional[str] = None)

Parse the proxy settings from a string

Parameters
  • proxy_string : str — The string is in the format of: protocol://user:password@host:port or protocol://host:port e.g. http://user:password@localhost:8080 or http://localhost:8080
  • exclude_hosts : str — The hosts that should be excluded from the proxy, e.g. localhost, separated by a comma
Returns

ProxySettings — The proxy settings object

method has_credentials() → bool
attribute host_name : Optional[str]
attribute password : Optional[str]
attribute port_number : Optional[str]
attribute protocol_name : Optional[str]
method set_as_environment_variable()

Set the proxy settings as environment variables.

staticmethod supported_proxy_protocols() → str

Return the supported proxy protocols for KNIME proxy settings in Python.

Returns

str — A string containing the list of supported proxy protocols.

attribute user_name : Optional[str]

function knime.extension.get_proxy_settings(protocol_name: Optional[str] = None) → Optional[ProxySettings]

Get the proxy settings from the environment variables.

Get the proxy settings as configured either in KNIME’s preferences or via environment variables. Even if the proxy settings were configured in KNIME’s preferences only, they are already set as environment variables for this Python process, so they are in effect for everything you do.

Parameters
  • protocol_name : str — The protocol name, e.g. 'http' or 'https'. To see all supported protocols, call ProxySettings.supported_proxy_protocols(). If not provided, the function will return the first proxy settings it finds.
Returns

ProxySettings — The proxy settings object.