Skip to content

Latest commit

 

History

History
143 lines (93 loc) · 2.27 KB

callback.md

File metadata and controls

143 lines (93 loc) · 2.27 KB
description
Get and receive data from outside Naas network, usefull for OAuth and other need who need light and fast response.

👈 Callback

{% hint style="info" %} In local you need to run the callback machine to make it work. refer to the doc to install it. {% endhint %}

Create

Create callback URL

url, uuid = naas.callback.add()

Without self destroy

url, uuid = naas.callback.add(auto_delete=False)

With custom response

url, uuid = naas.callback.add(response={"toto": "tata"})

With custom response headers

url, uuid = naas.callback.add(response_headers={"toto": "tata"})

With default result

url, uuid = naas.callback.add(default_result={"toto": "tata"})

Disable override response

If URL is called multiple time, only the first response will be kept

url, uuid = naas.callback.add(no_override=True)

For specifics user (Admin)

url, uuid = naas.callback.add(user="[email protected]")

Force UUID (Admin)

url, uuid = naas.callback.add(user="[email protected]", uuid="test")

List

You can list all callback you have created

df = naas.callback.list()

For specifics user (Admin)

df = naas.callback.list(user="[email protected]")

Get

You can get a callback result.

if a callback didn't been called yet, the result will be None

data, headers = naas.callback.get(uuid)

Wait until data present

{% hint style="info" %} It will wait a maximum of 3000 sec {% endhint %}

data, headers = naas.callback.get(uuid, True)

Wait until data present with Timeout

timeout is in seconds

data, headers = naas.callback.get(uuid, True, 10)

Get the full data

data = naas.callback.get(uuid, raw=True)

For specifics user (Admin)

url, uuid = naas.callback.get(uuid, user="[email protected]")

Delete

You can remove any callback by UUID.

naas.callback.delete(uuid)

For specifics user (Admin)

naas.callback.delete(user="[email protected]")

List all (Admin)

Allows retrieving all callback made by all users as admin.

import naas
naas.callback.list_all()