RemoteConfig

Note

We recommend you save your token only on a personal computer, not on shared/public ones.

class perceval.runtime.remote_config.RemoteConfig(persistent_data=<perceval.utils.persistent_data.PersistentData object>)

Handle the remote configuration.

Parameters:

persistent_data (PersistentData) – The persistent data access to use. In a standard environment, always use the default.

static clear_cache()

Delete the RemoteConfig cache.

get_proxies()

Get the proxy configuration as a mapping of protocols to URLs.

Return type:

dict[str, str]

static get_token_env_var()

Get the name of the environment variable storing a token.

Return type:

str

get_url()

Search a valid cloud URL from the environment, put it in cache and return it.

The priority for the URL search is as follows: * A URL already in cache (e.g. set by the user or already found in a previous call) * The value in Perceval persistent configuration

Return type:

str

Returns:

The cloud URL

save()

Save the current remote configuration on disk. After this, the configuration is persistent and can be found in other Perceval sessions (even in different virtual envs).

Return type:

None

static set_proxies(proxies)

Set the proxy configuration.

Usage example:

>>> rc = RemoteConfig()
>>> rc.set_proxies({"http": "http://user:pass@192.168.0.1",
...                 "https": "http://user:pass@192.168.0.1:8080"
...                })
Parameters:

proxies (dict[str, str]) – proxy configuration in the form of a dictionary which maps protocols to URLs

Return type:

None

static set_token(token)

Set a user authentication token in the configuration cache. It is not saved on disk before the save method is called.

Parameters:

token (str) – The token

Return type:

None

static set_url(url)

Set a cloud URL in the configuration cache. It is not saved on disk before the save method is called.

Parameters:

url (str) – The cloud URL

Return type:

None