Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
jupyter-naas
GitHub Repository: jupyter-naas/awesome-notebooks
Path: blob/master/Algolia/Algolia_Setup_connection.ipynb
2973 views
Kernel: Python 3

Algolia.png

Algolia - Setup connection

Give Feedback | Bug report

Tags: #algolia #naas #secret #connection #setup

Last update: 2023-11-21 (Created: 2023-11-21)

Description: This notebook help you setup your connection with Algolia and add required credentials to Naas secret. You will be able to establish a seamless connection to Algolia without the need to repeatedly redefine your credentials in variables by using naas.secret.get() in your notebook.

Input

Import libraries

import naas

Setup variables

Mandatory

  • app_id: Algolia application ID. This value will be stored under the secret 'ALGOLIA_APP_ID'.

  • api_key: Algolia API key. This value will be stored under the secret 'ALGOLIA_API_KEY'.

Optional

  • secrets: Dict to add secrets to naas

# Mandatory app_id = None api_key = None # Optional secrets = { "ALGOLIA_APP_ID": app_id, "ALGOLIA_API_KEY": api_key, }

Model

Add secret

for secret in secrets: new_value = secrets.get(secret) if new_value: naas.secret.add(secret, secrets.get(secret))

Output

Display result

df = naas.secret.list() df = df[df["name"].isin(secrets.keys())] df