获取API打电话以将PDF拉入R
直到2021年,此代码一直很好地运行。在长时间的其他项目经过此操作之后。 Cals成功获得了200个状态,但不确定保存的PDF或PNG文件未打开的原因是什么。我试图打开PDF文件时遇到的错误是“ Adobe Acrobat无法打开'test.pdf',因为它是不是支持的文件类型,或者因为文件已损坏(例如,它是作为电子邮件附件发送的并且没有正确解码)。”
httr::GET(
url ="https://public.tableau.com/app/profile/joti.gautam/viz/Book3_16512272064090/Dashboard.pdf",
httr::write_disk(here::here("test.pdf"),overwrite = T),
httr::progress()
)
This code was working perfectly fine until 2021. After a long time ran this for some other project. The cals are successful with 200 status, but Not sure what is the reason the saved pdf or png file does not open. The error I get when trying to open the pdf file is "Adobe Acrobat could not open 'test.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded)."
httr::GET(
url ="https://public.tableau.com/app/profile/joti.gautam/viz/Book3_16512272064090/Dashboard.pdf",
httr::write_disk(here::here("test.pdf"),overwrite = T),
httr::progress()
)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您会得到200,因为请求成功返回了HTML。它不会直接链接到PDF。开发人员工具中的一点窥探显示了实际pdf的正确URL:
test.pdf
You are getting a 200 because the request successfully returns html. It doesn't link directly to a pdf. A little snooping in the developer tools reveals the correct url for the actual pdf:
test.pdf