python自動化呼び出しBaiduアプリ解決検証コード
自動化テストの検証コードが登録された3つの解決方法
1、開発閉鎖の検証コードを探しています。
2、開発設定の万能検証コードを探しています。
3,第三者インターフェースを使って検証Cを識別すると100%認識できなくなります。自分で作ったocrより識別率が高いです。
具体的には第三種類の百度雲識別認証コードを呼び出します。
アクセス:百度の雲
クリックして直ちに使用します。――ログインします。実名認証です。
自分の需要に応じて選んでいます。無料は基本的に十分です。
これが自分のAKBとSKです。
そしてコードに書いてAKとSKを送ればいいです。
ここでは、python自動化の呼び出しについてBaiduアプリの検証コードの記事を紹介します。Baiduアプリの検証コードの内容については、以前の記事を検索したり、下記の関連記事を見たりしてください。これからもよろしくお願いします。
1、開発閉鎖の検証コードを探しています。
2、開発設定の万能検証コードを探しています。
3,第三者インターフェースを使って検証Cを識別すると100%認識できなくなります。自分で作ったocrより識別率が高いです。
具体的には第三種類の百度雲識別認証コードを呼び出します。
from selenium import webdriver
from PIL import Image
import base64
import requests
import time
def baidu_api(Verification_code, AK, SK):#Verification_code ,AK,SK
chrome.get_screenshot_as_file('reg.png') #
code_img = chrome.find_element_by_xpath(Verification_code) #
img = Image.open('reg.png')#
c_img = img.crop((code_img.location['x'], code_img.location['y'], code_img.location['x'] + code_img.size['width'],
code_img.location['y'] + code_img.size['height'])) #
c_img.save('reg_code.png')
host = 'https://aip.baidubce.com/oauth/2.0/token?grant_type=client_credentials&' \
'client_id='+AK+'&' \
'client_secret='+ SK
response = requests.get(host)
token = response.json()['access_token']
request_url = "https://aip.baidubce.com/rest/2.0/ocr/v1/accurate_basic"
f = open('reg_code.png', 'rb')#
img = base64.b64encode(f.read())
params = {"image": img}
access_token = token
request_url = request_url + "?access_token=" + access_token
headers = {'content-type': 'application/x-www-form-urlencoded'}
response = requests.post(request_url, data=params, headers=headers)
dict_a = response.json()['words_result']
if response:
dict_a = eval(str(dict_a)[1:-1])#
dict_a = dict(dict_a)#
dict_a = dict_a['words']
dict_a = "".join(dict_a.split()) #
dict_a = dict_a.lower()#
return dict_a
else:
chrome.refresh()
chrome = webdriver.Chrome()#
chrome.maximize_window()#
chrome.get(' ')
test = baidu_api(Verification_code, AK, SK)#
chrome = webdriver.Chrome()
print(test)#
BaiduクラウドAK、SKの取得:アクセス:百度の雲
クリックして直ちに使用します。――ログインします。実名認証です。
自分の需要に応じて選んでいます。無料は基本的に十分です。
これが自分のAKBとSKです。
そしてコードに書いてAKとSKを送ればいいです。
ここでは、python自動化の呼び出しについてBaiduアプリの検証コードの記事を紹介します。Baiduアプリの検証コードの内容については、以前の記事を検索したり、下記の関連記事を見たりしてください。これからもよろしくお願いします。