by: Kevin Broløs & Tom Jelen
(Feyn version 1.4 or newer)
The keys to the self-driving car
In order to use your
QLattice, you need two key components.
You can get both of these pieces of information from the dashboard.
QLattice URL consists of two parts - our
QLattice URL, and a
It will look something like this:
On your dashboard, it can be found under
[QLattice_Name] > Details :: QLattice url.
User Access Token
User Access Token is your authentication credential for accessing the QLattice (so keep it safe). It can be found on the same dashboard page as above, under
[QLattice_Name] > Details :: User Access Token and will look something like this:
Using your credentials
In short, you can provide your credentials in three different ways:
- As parameters in the initializer.
- From a configuration file.
- From environment variables.
In the constructor
This is the simplest way. You just pass them in as the arguments
api_token to the QLattice constructor.
from feyn import QLattice qlattice = QLattice(url = "https://qlattice.abzu.ai/qlattice-a1b2c3d4", api_token = "c1a2c3a406d6e6729012e0de4d8c7a2c")
From a configuration file
Alternatively, you can store them in a local configuration file like this:
[QuesadillaLattice] url = https://qlattice.abzu.ai/qlattice-a1b2c3d4 api_token = c1a2c3a406d6e6729012e0de4d8c7a2c [QuibbleLattice] url = ... api_token = ...
The configuration file should be placed in your home folder (or in the
.config subfolder), and be called
feyn.ini if you are on Windows, otherwise
With the configuration file in place, you can connect to the QLattice by specifying which configuration section to use. Or none at all, and the first configuration section will be used.
from feyn import QLattice qlattice = QLattice() # Will use the QuesadillaLattice section. qlattice = QLattice(config="QuibbleLattice") # Loads the QuibbleLattice configurations.
We recommend you use this approach, as it allows you to share code with others, without accidentially disclosing your access token.
From environment variables
The last way is to set two environment variables
This is often convinient for automated processes, such as continuous integration servers.
FEYN_QLATTICE_URL = https://qlattice.abzu.ai/qlattice-a1b2c3d4 FEYN_QLATTICE_API_TOKEN = c1a2c3a406d6e6729012e0de4d8c7a2c
With the environment variables set, you can initialize a QLattice without specifying authentication parameters.
from feyn import QLattice qlattice = QLattice() # No parameters necessary when environments set
It's very easy, because
feyn uses standard
HTTPS to communicate with your
QLattice is running in the abzu cluster on
Therefore, if you can reach https://qlattice.abzu.ai/firewall-test from the computer running
feyn, then you are good to go.
Also, proxies are supported automatically, as long as they are configured in one of the most common ways on your OS.