Configuration Details#


Be careful not to accidentally add your credentials to online repositories or containers. You can use the CLI command viresclient clear_credentials to remove them from your environment. By default, this is just a file located at ~/.viresclient.ini, where ~ is your home directory which is dependent on the operating system.


To get started quickly in Jupyter notebooks:

from viresclient import SwarmRequest
r = SwarmRequest("")


from viresclient import AeolusRequest
r = AeolusRequest("")

… then follow automatic instructions to configure token if not already set


URL’s on this page assume using VirES for Swarm. If using Aeolus instead, replace { and SwarmRequest} with { and AeolusRequest}

While it is possible to enter the server URL and access credentials (see Access Token Management) each time a new request object is created,

from viresclient import SwarmRequest

# both URL and access token passed as request object's parameters
request = SwarmRequest(

it is more convenient to omit them from the code and store them in a private configuration file. This configuration can be done using the viresclient.set_token() convenience function, the underlying viresclient.ClientConfig() module, or the command line interface (CLI) - see below. These will all set the configuration options in a file which is by default located at ~/.viresclient.ini which can be edited directly, containing for example:

token = r-8-mlkP_RBx4mDv0di5Bzt3UZ52NGg-

url =

When creating the configuration file manually make sure the file is readable by its owner only:

$ chmod 0600 ~/.viresclient.ini
$ ls -l ~/.viresclient.ini
-rw-------  1 owner owner  361 May 12 09:12 /home/owner/.viresclient.ini

When the configuration file is present, then the url and token options can be omitted from requests:

# access token read from configuration
request = SwarmRequest(url="")

# both default URL and access token read from configuration
request = SwarmRequest()

The following sections describe how to set the configuration.

Configuration via CLI#

The viresclient shell command can be used to set the server access configuration:

$ viresclient set_token
Enter access token: r-8-mlkP_RBx4mDv0di5Bzt3UZ52NGg-

$ viresclient set_default_server

Clear the configuration from the default location with:

$ viresclient clear_credentials

See also: Command Line Interface (CLI)

Configuration via Python#

Use the following code to store the token in the viresclient configuration:

from viresclient import ClientConfig

cc = ClientConfig()
cc.set_site_config("", token="r-8-mlkP_RBx4mDv0di5Bzt3UZ52NGg-")
cc.default_url = ""

Alternatively, use the convenience function:

from viresclient import set_token
# (you will now be prompted to enter the token)

which calls the same code as above, but makes sure the token remains hidden so that it can’t accidentally be shared.

For developers & DISC users#

The accounts for the staging server (, and DISC server ( are separate. Tokens can be similarly generated on these and stored in the same configuration file alongside the others:

$ viresclient set_token
Enter access token: r-8-mlkP_RBx4mDv0di5Bzt3UZ52NGg-

$ viresclient set_token
Enter access token: VymMHhWjZ-9nSVs-FuPC27ca8C6cOyij

Using SwarmRequest() without the url parameter will use the default URL set above. To access a non-default server the URL parameter must be used:

from viresclient import SwarmRequest

# request using the default server (
request = SwarmRequest()

# request to an alternative, non-default server
request = SwarmRequest(url="")