Adding copilot IVA requests to posting
This commit is contained in:
15
copilot/posting/copilotux/authorization.py
Normal file
15
copilot/posting/copilotux/authorization.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from posting import Posting
|
||||
import httpx
|
||||
|
||||
|
||||
def on_response(response: httpx.Response, posting: Posting) -> None:
|
||||
# Raise an exception if the request failed
|
||||
response.raise_for_status()
|
||||
# Set a variable to be used in later requests.
|
||||
# You can write '$auth_token' in the UI and it will be substituted with
|
||||
# the value of the $auth_token variable.
|
||||
|
||||
access_token = response.json().get("access_token")
|
||||
print ("Successfully obtained access_token")
|
||||
|
||||
posting.set_variable("access_token", access_token)
|
||||
Reference in New Issue
Block a user