Accessing your QLattice
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
The QLattice
URL consists of two parts - our QLattice
URL, and a QLattice Token
.
It will look something like this:
On your dashboard, it can be found under [QLattice_Name] > Details :: QLattice url
.
User Access Token
The 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:
c1a2c3a406d6e6729012e0de4d8c7a2c
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 url
and 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 .feynrc
.
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 FEYN_QLATTICE_URL
and FEYN_QLATTICE_API_TOKEN
.
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
Firewalls
It's very easy, because feyn
uses standard HTTPS
to communicate with your QLattice
. The QLattice
is running in the abzu cluster on qlattice.abzu.ai
.
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.