【影刀RPA_启动任务api】

影刀RPA_启动任务api

#启动任务api
import requests

yingdao_Info={
    "accessKeyId":"XXXX",
    "accessKeySecret":"XXXX",
    "scheduleUuid":'XXXX',
    "robotUuid":"XXXX"}

#1.获取token
def get_access_tocken():
    url="https://api.yingdao.com/oapi/token/v2/token/create"
    headers={
        "Content-Type":"application/x-www-form-urlencoded"
    }
    params={
        "accessKeyId":yingdao_Info["accessKeyId"],
        "accessKeySecret":yingdao_Info["accessKeySecret"]
    }
    response = requests.post(url=url,headers=headers,params=params)
    return response.json()['data']['accessToken']

# print(get_access_tocken())

#2、启动任务
def start_task():
    url="https://api.yingdao.com/oapi/dispatch/v2/task/start"
    headers={
        "Authorization":f"Bearer {get_access_tocken()}",
        "Content-Type":"application/json"
    }
    body={
        "scheduleUuid": yingdao_Info["scheduleUuid"],
        "scheduleRelaParams":[{
         "robotUuid":yingdao_Info["robotUuid"],
        "params":[{"name":"姓名","value":"小刘","type":"str"}]
        }]
    }
    response = requests.post(url=url,headers=headers,json=body)
    print(f"影刀返回:\n{response.json()}")
    return response.json()

start_task()

你可能感兴趣的:(rpa,数据库,服务器)