linkahead.connection.connection module

Connection to a LinkAhead server.

linkahead.connection.connection.configure_connection(**kwargs)

Configures the LinkAhead connection and returns the Connection object.

The effective configuration is governed by the default values (see ‘Parameters’), the global configuration (see linkahead.get_config()) and the parameters which are passed to this function, with ascending priority.

The parameters which are listed here, are possibly not sufficient for a working configuration of the connection. Check the configure method of the implementation class and the password_method for more details.

Parameters:
  • url (str) – The url of the LinkAhead Server. HTTP and HTTPS urls are allowed. However, it is highly recommend to avoid HTTP because passwords and authentication token are send over the network in plain text.

  • username (str) – Username for login; e.g. ‘admin’.

  • password (str) – Password for login if ‘plain’ is used as password_method.

  • password_method (str) – The name of a submodule of linkahead.connection.authentication which implements the AbstractAuthenticator interface. (Default: ‘plain’) Possible values are, for example: - “plain” Need username and password arguments. - “input” Asks for the password. - “pass” Uses the pass password manager. - “keyring” Uses the keyring library. - “auth_token” Uses only a given auth_token.

  • timeout (int) – A connection timeout in seconds. (Default: 210)

  • ssl_insecure (bool) – Whether SSL certificate warnings should be ignored. Only use this for development purposes! (Default: False)

  • auth_token (str (optional)) –

    An authentication token which has been issued by the LinkAhead Server. Implies password_method=”auth_token” if set. An example token string would be ``[“O”,”OneTimeAuthenticationToken”,”anonymous”,[“administration”],[],1592995200000,

    604800000,”3ZZ4WKRB-5I7DG2Q6-ZZE6T64P-VQ”,”197d0d081615…1ee9”,1,30000]``.

  • https_proxy (str, optional) – Define a proxy for the https connections, e.g. http://localhost:8888, socks5://localhost:8888, or socks4://localhost:8888. These are either (non-TLS) HTTP proxies, SOCKS4 proxies, or SOCKS5 proxies. HTTPS proxies are not supported. However, the connection will be secured using TLS in the tunneled connection nonetheless. Only the connection to the proxy is insecure which is why it is not recommended to use HTTP proxies when authentication against the proxy is necessary. If unspecified, the https_proxy option of the pylinkahead.ini or the HTTPS_PROXY environment variable are being used. Use None to override these options with a no-proxy setting.

  • http_proxy (str, optional) – Define a proxy for the http connections, e.g. http://localhost:8888. If unspecified, the http_proxy option of the pylinkahead.ini or the HTTP_PROXY environment variable are being used. Use None to override these options with a no-proxy setting.

  • implementation (CaosDBServerConnection) – The class which implements the connection. (Default: _DefaultCaosDBServerConnection)

Returns:

The singleton instance of the _Connection class.

Return type:

_Connection

linkahead.connection.connection.get_connection()

Return the connection.

If the connection was not configured yet configure_connection will be called inside this function without arguments.