login
Authenticate dbnl SDK
dbnl.login(
*,
api_token: Optional[str] = None,
namespace_id: Optional[str] = None,
api_url: Optional[str] = None,
app_url: Optional[str] = None,
) -> None
Setup dbnl SDK to make authenticated requests. After login is run successfully, the dbnl client will be able to issue secure and authenticated requests against hosted endpoints of the dbnl service.
dbnl.login
must be run before any other functions in the DBNL workflow
Parameters
api_token
The API token used to authenticate your DBNL account. You can generate your API token at https://app.dbnl.com/tokens (also, see accessing DBNL token). If none is provided, the environmental variable DBNL_API_TOKEN
will be used by default.
namespace_id
Namespace ID to use for the session; available namespaces can be found with get_my_namespaces()
.
api_url
The base url of the Distributional API. For SaaS users, set this variable to api.dbnl.com
. For other users, please contact your sys admin.
app_url
An optional base url of the Distributional app. If this variable is not set, the app url is inferred from the DBNL_API_URL
variable. For on-prem users, please contact your sys admin if you cannot reach the Distributional UI.
Examples
import dbnl
# when login() is called without specifying a token,
# it will use the `DBNL_API_TOKEN` env var
dbnl.login()
# login() can be called with a specific API Token
dbnl.login(api_token="YOUR_TOKEN_AAAA_BBBB_CCCC_DDDD")
Was this helpful?