使用ddddocr识别验证码

import urllib3
import ddddocr

code_url = "http://www.xxxx.com/code.php"
headers = "{你的header是内容}"

http = urllib3.PoolManager() resq = http.request('GET', code_url,headers=headers) img_content_bytes = resq.data with open ('/root/yzm.png',mode='w+b') as fi: fi.write(img_content_bytes)
#保存为/root/yzm.png图片
#使用ddddocr识别刚才保存的图片

ocr = ddddocr.DdddOcr()
with open('/root/yzm.png', 'rb') as f:
  img_bytes = f.read()
ver_code = ocr.classification(img_bytes)
print(ver_code)

 

posted @ 2023-01-15 10:24  忙碌在路上  阅读(698)  评论(0编辑  收藏  举报