python - 使用 selenium 下载 pdf
问题描述
尝试使用硒下载 pdf
我的代码
bills_href = selenium_controller.search_bills(browser)
for count,i in enumerate(bills_href):
r = requests.get(i, stream=True,verify=False)
with open(("python%s.pdf")%(count), "wb") as pdf:
for chunk in r.iter_content(chunk_size=1024):
if chunk:
pdf.write(chunk)
bills_href = list of links of pdf
但是当我打开我的 PDF 文件时,它显示它已损坏,甚至无法打开它
解决方案
推荐阅读
- networking - 如何在网络上选择具有最大或最小中心度的海龟并为其分配特定状态
- java - SpringBoot:如何通过 RestTemplate HttpMethod GET 发送对象?
- git - 当我将功能分支重新设置为主分支与将主分支重新设置为功能时有什么区别,以及何时使用它们?
- excel - 从 Outlook 导入约会
- spring-boot - Zuul 网关总是返回状态 200 - docker compose
- wordpress - Wordpress - 插入 ACF php
- asynchronous - Celery 任务中的同步 IO 功能?
- phpunit - 如何使用 pcov 获得代码覆盖率报告?
- javascript - 在 Knockout.js 中重新填充选项后,下拉列表中的值绑定未更新
- angular - 再次调用时,离子菜单返回 false