在Micro Focus RPA中使用python移动消息的API修补程序请求

在Micro Focus RPA中使用python移动消息的API修补程序请求,python,automation,rpa,microfocus,Python,Automation,Rpa,Microfocus,我需要创建一个补丁请求,使用Micro Focus Robotic Process Automation应用程序将电子邮件移动到另一个文件夹中。这个应用程序的语法与普通python不同,我很难理解它 如果我删除了“head”行、“authorization”行,以及在“response”行中调用“header”和“authorization”,下面的代码就可以使用了 但很明显,它返回的代码是401,因为没有授权 授权部分抛出此错误:'str'对象不可调用 headers部分抛出此错误:'str'

我需要创建一个补丁请求,使用Micro Focus Robotic Process Automation应用程序将电子邮件移动到另一个文件夹中。这个应用程序的语法与普通python不同,我很难理解它

如果我删除了“head”行、“authorization”行,以及在“response”行中调用“header”和“authorization”,下面的代码就可以使用了

但很明显,它返回的代码是401,因为没有授权

授权部分抛出此错误:
'str'对象不可调用

headers部分抛出此错误:
'str'对象没有属性'items

代码从这里开始:

我想出来了:

def execute(messageID, accessToken): 
    import importlib
    requests = importlib.import_module('requests')

url = 'https://graph.microsoft.com/v1.0/users/{{user}}/messages/' + messageID + '/move'
body = "{\"destinationId\":\"{{folderID}}\"}"
head = {"Content-Type": "application/json;charset=UFT-8", "Authorization": "Bearer " + accessToken}

response = requests.post(url, data=body, headers=head)
return {'response':response}
我想出来了:

def execute(messageID, accessToken): 
    import importlib
    requests = importlib.import_module('requests')

url = 'https://graph.microsoft.com/v1.0/users/{{user}}/messages/' + messageID + '/move'
body = "{\"destinationId\":\"{{folderID}}\"}"
head = {"Content-Type": "application/json;charset=UFT-8", "Authorization": "Bearer " + accessToken}

response = requests.post(url, data=body, headers=head)
return {'response':response}

你能发布完整的回溯吗?尝试删除
head
authorization
行中的双引号,使它们看起来像
head={'Content-Type':'application/json;charset=UTF-8'}
authorization={'authorization':'Bearer'+accessToken+“}
您能发布完整的回溯吗?尝试删除
head
authorization
行中的双引号,使它们看起来像
head={'Content-Type':'application/json;charset=UTF-8'}
authorization={'authorization':'Bearer'+accessToken+“}
def execute(messageID, accessToken): 
    import importlib
    requests = importlib.import_module('requests')

url = 'https://graph.microsoft.com/v1.0/users/{{user}}/messages/' + messageID + '/move'
body = "{\"destinationId\":\"{{folderID}}\"}"
head = {"Content-Type": "application/json;charset=UFT-8", "Authorization": "Bearer " + accessToken}

response = requests.post(url, data=body, headers=head)
return {'response':response}