kenken999's picture
df
3f4c733
raw
history blame
1.04 kB
import requests
import json
# current_user: User = Depends(get_current_active_user)):
# oauth2_scheme = OAuth2PasswordBearer(tokenUrl="/token")
def get_senario(table):
APPSHEET_APPID = os.getenv("APPSHEET_APPID")
APPSHEET_KEY = os.getenv("APPSHEET_KEY")
table = "本日の金価格"
url = f"https://api.appsheet.com/api/v2/apps/{APPSHEET_APPID}/tables/{table}/Action"
payload = {
"Action": "Find",
"Properties":{
},
"Rows":[]}
headers = {
"contentType": "application/json",
"ApplicationAccessKey": APPSHEET_KEY,
"Content-Type": "application/json",
}
messages = []
response = requests.request("POST", url, headers=headers, data=json.dumps(payload))
for i in response.json():
print(i)
#print(i["role"])
#print(i["content"])
messages.append({"role":i["role"],"content":i["content"]})
#print(messages)
return messages
res = get_senario("査定OK")
print(res)
#print(response.json())