生活随笔
收集整理的這篇文章主要介紹了
验证码ocrking接口
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
利用requests調用OCRKing接口
- 前幾天看到一個PIL制作驗證碼的文字這幾天想怎么學習接口破解簡單驗證碼
- OcrKing 對于驗證碼的效果還行,雖然不如uu云 但是對于免費的來說夠用了,只是學習而已
- apikey建議自己獲取一個反正也是免費的,異地調用會被封號==
import requests,re
key=
'馬賽克'
url=
'http://api.ocrking.com/server.html'
url2=
'http://lab.ocrking.com/ok.html'
headers = {
"Accept":
"text/html,application/xhtml+xml,application/xml;",
"Accept-Encoding":
"gzip",
"Accept-Language":
"zh-CN,zh;q=0.8",
"Referer":
"http://www.example.com/",
"User-Agent":
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36"}img=open(
r'C:\Users\sunqi\Desktop\testcode\54.png',
'rb')set1={
'url':
'',
'service':
'OcrKingForCaptcha',
'language':
'eng',
'charset':
'7',
'apiKey':key,
'type':
'http://www.unknown.com'
}
file={
'ocrfile':(
'123.png',img.read(),
'application/octet-stream')}
r=requests.post(url2,data=set1,files=file,headers=headers)
s=r.text
result=re.findall(
r'<Result>(.*)</Result>',s)[
0]
status=re.findall(
r'<Status>(.*)</Status>',s)[
0]
print(status,result)
OcrKing官方Api github
總結
以上是生活随笔為你收集整理的验证码ocrking接口的全部內容,希望文章能夠幫你解決所遇到的問題。
如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。