🔋 Advanced usecases

Timezone

Set timezone

import naas
naas.set_remote_timezone("Europe/Lisbon")

Get timezone

import naas
naas.get_remote_timezone()

Download URL

Create a download link to Naas from any URL, it can be in GitHub, or anywhere!

import naas
url = "https://github.com/jupyter-naas/awesome-notebooks/blob/master/Airtable/Airtable_delete_data.ipynb"
dl_url = naas.get_download_url(url)

Result :

https://app.naas.ai/user-redirect/naas/downloader?url=YOURURL

Options: mode_api

with &mode_api=yes that create the file in the user but don't open it. Useful for admin

Options: name

with ?name=toto that create a file in the user with the name provided `toto`

if no URL provided it create an empty file.

Run

run a notebook direct in production and get the result.

import naas
naas.run()

Changelog

Show changelog

import naas
naas.changelog()

Feature request

show feature request inside Jupyter

import naas
mode = "naas" # can be naas, naas_drivers, awesome_notebook
naas.feature_request(mode)

Check if you are in production

import naas
naas.is_production()

Reload jobs

If you need to force update the job list by editing the file in your `.naas/jobs.json`

import naas
naas.reload_jobs()

N_ENV

This represents the Naas env vars, you can get all to make your script work `naas.n_env`

api_port
current
version
remote_mode
api
notif_api
callback_api
proxy_api
hub_api
any_user_url
user_url
naas_folder
server_root
path_naas_folder
shell_user
remote_api
token
user
tz
sentry_dsn
scheduler
scheduler_interval
scheduler_job_max
scheduler_job_name
scheduler_timeout

Current

get data in the production of the current running notebook.

For now current gives you this :

import naas
print(naas.n_env.current)
# This will be empty in dev = in notebook run by you
# and with vars when run by naas runner ( scheduler or webhook )