phtyon读取pdf的远程地址解析内容

import xlwt,pymysql,requests,json,datetime,PyPDF2,urllib.request,io,ssl

添加context 解决读取pdf时SSL报错问题

context = ssl._create_unverified_context()

读取pdf地址 获取pdf内容

req = urllib.request.urlopen(contract_download_url,context=context)

remote_file=req.read()

memory_file = io.BytesIO(remote_file)

read_pdf = PyPDF2.PdfReader(memory_file)

获取pdf页数

number_of_pages = len(read_pdf.pages)

for i in range(0, number_of_pages):

pageObj = read_pdf.pages[i]

获取当前页数的pdf内容

page = pageObj.extract_text()

处理后续业务流程 .......................

相关推荐
团子和二花27 分钟前
openclaw平替之nanobot源码解析(七):Gateway与多渠道集成
python·gateway·agent·智能体·openclaw·nanobot
未知鱼32 分钟前
Python安全开发之简易目录扫描器(含详细注释)
开发语言·python·安全
Be1k036 分钟前
推荐一款语雀知识库批量导出工具
python·gui·工具·语雀·批量导出·原创
Sunshine for you1 小时前
如何用FastAPI构建高性能的现代API
jvm·数据库·python
阿贵---1 小时前
Python Web爬虫入门:使用Requests和BeautifulSoup
jvm·数据库·python
Red丶哞2 小时前
内网自建Postfix使用Python发送邮件
开发语言·python
rebekk2 小时前
pytorch custom op的简单介绍
人工智能·pytorch·python
chushiyunen2 小时前
uv使用笔记(python包的管理工具)
笔记·python·uv
曲幽2 小时前
FastAPI状态共享秘籍:别再让中间件、依赖和路由“各自为政”了!
python·fastapi·web·request·state·depends·middleware
风清扬【coder】2 小时前
Anaconda 被误删后抢救手册:数据恢复 + 环境重建应急流程
python·数据恢复·anaconda·环境重建