我正在Zapier中创建一个zap,搜索特定的客户机,然后在Google Drive中找到他们的文件夹。然后它从Google Drive文件夹中获取一个PDF文档,并上传到HelloSign以发送到客户端。我正在使用Zapier step的代码从Google Drive中提取PDF并上传到HelloSign
Zapier step的代码中的代码在我的本地机器上运行,但是当我尝试在Zapier中运行它时,我会为我尝试创建的文档获取“OSError:[Errno 30]只读文件系统”,这样我就可以读取包含“with open('Test.PDF','wb')as f”的行的PDF。从读取another comment可以看出,这似乎是由于Zapier权限不允许在其系统上创建文件造成的。出错的代码块非常简单
output = {'status_code' : ''}
key = 'xxxxxxxx'
url = 'https://' + key + ':@api.hellosign.com/v3/signature_request/send'
response = requests.get(input['pdf'])
with open('Test.pdf','wb') as f:
pdf = f.write(response.content)
files = {
'Doc' : pdf
}
param = {
'test_mode' : 1,
'title' : "Test from HelloSign",
'subject' : "Doc Ready",
'message' : 'Hi! Please sign the attached doc.',
'signing_redirect_url' : 'https://www.google.com/',
'signers[0][name]' : input['name'],
'signers[0][email_address]' : input['email']
}
r = requests.post(url=url,files = files, params=param)
output['status_code'] = r.status_code
如果不使用open()阅读PDF,那么我可以将PDF传递给HelloSign发送,还有什么其他选择
这应该行得通
相关问题 更多 >
编程相关推荐