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

Bitly.png

Bitly - Setup connection

Give Feedback | Bug report

Tags: #bitly #naas #secret #connection #setup

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

Description: This notebook help you setup your connection with Bitly and add required credentials to Naas secret. You will be able to establish a seamless connection to Bitly 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

  • bitly_token: Bitly Access Token. This value will be stored under the secret 'BITLY_TOKEN'.

Optional

  • secrets: Dict to add secrets to naas

# Mandatory bitly_token = None # Optional secrets = { "BITLY_TOKEN": bitly_token, }

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