Rasa x chat api with python on gcp

please refer to the following python code for the implementation of the rasa x chat API in GCP deployed version.

#rasa X implementation code import requests

url = “http://youripaddress/api/auth/

payload="{\r\n “username”:“your username”,\r\n “password”:“your password”\r\n}" headers = { ‘Content-Type’: ‘text/plain’ }

response = requests.request(“POST”, url, headers=headers, data=payload)

#print(response.text)

token = response.text.split(":")[1].replace(’"’,’’).replace("}",’’) #print(token)

url = “http://youripaddress/api/chat

payload="{\n “message”: “sleep data”\n}" headers = { ‘Content-Type’: ‘application/json’, ‘Authorization’: f’Bearer {token}’ }

response = requests.request(“POST”, url, headers=headers, data=payload)

print(response.text)