【发布时间】:2021-07-13 23:35:16
【问题描述】:
我正在 Zapier 中创建一个 zap,用于搜索特定客户,然后在 Google Drive 中找到他们的文件夹。然后,它从 Google Drive 文件夹中获取一个 PDF 文档并上传到 HelloSign 以发送给客户端。我正在使用 Zapier 的代码步骤从 Google Drive 中提取 PDF 并上传到 HelloSign。
Zapier 步骤中的代码可以在我的本地计算机上运行,但是当我尝试在 Zapier 中运行它时,我得到我正在尝试的文档的“OSError: [Errno 30] Read-only file system”创建以便我可以阅读具有“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 以发送?
【问题讨论】: