def code_online(file_name): r = ShowapiRequest("http://route.showapi.com/184-4","62626","d61950be50dc4dbd9969f741b8e730f5" ) r.addBodyPara("typeId", "35") r.addBodyPara("convert_to_jpg", "0") r.addFilePara("image", file_name) #文件上传时设置 res = r.post() print(res.text) text = res.json()['showapi_res_body']['Result'] return text
def get_code_picture(self): file_path = self.get_picture(self.file_path) r = ShowapiRequest("http://route.showapi.com/184-4", "110187", "31fead27b6414c27b467e278ec3a62ed") r.addBodyPara("typeId", "35") r.addBodyPara("convert_to_jpg", "0") r.addFilePara("image", file_path) res = r.post() text = res.json()['showapi_res_body']['Result'] return text
def code_online(self,file_name): self.get_code_image(file_name) r = ShowapiRequest("http://route.showapi.com/184-4", "451433", "14410a0d29ea4c62858bb3f07c7f3767") r.addBodyPara("typeId", "35") r.addBodyPara("convert_to_jpg", "0") r.addFilePara("image", file_name) res = r.post() print(res.text) text = res.json()['showapi_res_body']['Result'] return text
def code_online(self,file_name): self.get_code_image(file_name) r = ShowapiRequest("http://route.showapi.com/184-4","62626","d61950be50dc4dbd9969f741b8e730f5" ) r.addBodyPara("typeId", "35") r.addBodyPara("convert_to_jpg", "0") r.addFilePara("image", file_name) #文件上传时设置 res = r.post() time.sleep(1) text = res.json()['showapi_res_body'] code = text['Result'] return code
def code_online(self, file_name): self.get_code_image(file_name) #卡在这不动啊 r = ShowapiRequest("http://route.showapi.com/184-4", "62626", "d61950be50dc4dbd9969f741b8e730f5") r.addBodyPara("typeId", "35") r.addBodyPara("convert_to_jpg", "0") r.addFilePara( "image", "D:/pyProject/PrimarySelenium/output/image/test002.png") #文件上传时设置 res = r.post() time.sleep(1) text = res.json()['showapi_res_body'] print(text) code = text['Result'] return code
def code_online(file_name): r = ShowapiRequest("http://route.showapi.com/184-4", "101098", "f6b3ad5dad704d429c54583d1c19207b") r.addBodyPara("img_base64", "utf-8") r.addBodyPara("typeId", "35") r.addBodyPara("convert_to_jpg", "0") r.addBodyPara("needMorePrecise", "0") r.addFilePara("image", file_name) res = r.post() print(res.text) text = res.json()['showapi_res_body']['Result'] return text
def discern_captcha_image(self, file_name): self.get_captcha_image(file_name) # 解析验证码图片中的文字(用第三方的图片验证码识别接口 ShowApiRequest) r = ShowapiRequest("http://route.showapi.com/184-4", "156943", "889229f1478e460883969df323f4865f") r.addBodyPara("img_base64", "") r.addBodyPara("typeId", "35") r.addBodyPara("convert_to_jpg", "0") r.addBodyPara("needMorePrecise", "0") r.addFilePara("image", file_name) # 文件上传时设置 res = r.post() text = res.json()["showapi_res_body"]["Result"] return text
def code_online(file_name): r = ShowapiRequest("http://route.showapi.com/184-5", "my_appId", "my_appSecret") r.addBodyPara("img_base64", "") # typeid=画像内に数字の数 r.addBodyPara("typeId", "35") r.addBodyPara("convert_to_jpg", "0") r.addBodyPara("needMorePrecise", "0") r.addFilePara("image", file_name) # 文件上传时设置 res = r.post() text = res.json()['showapi_res_body']["Result"] return text
def parseImg(file_name): getImg(file_name) r = ShowapiRequest("http://route.showapi.com/184-5", "91267", "1dbeca97548a4923adea21e917b3df8b") r.addBodyPara("typeId", "35") r.addBodyPara("convert_to_jpg", "0") r.addBodyPara("needMorePrecise", "0") r.addFilePara("image", file_name) #文件上传时设置 res = r.post() return res.json()['showapi-res_body']['Result']
def code_online(self, file_name): self.get_code_image(file_name) r = ShowapiRequest("http://route.showapi.com/184-4", "103592", "3388e72a386041dd85f8eb604914bcbd") r.addBodyPara("typeId", "35") r.addBodyPara("convert_to_jpg", "0") r.addFilePara("image", file_name) #文件上传时设置 r.addBodyPara("needMorePrecise", "0") res = r.post() text = res.json()['showapi_res_body']['Result'] time.sleep(2) return text
def code_online(self, file_name): self.get_code_image(file_name) r = ShowapiRequest("http://route.showapi.com/184-4", "166211", "a0459474e9f9489ab29a31ddb96bae51") r.addFilePara("image", file_name) r.addBodyPara("typeId", "35") r.addBodyPara("convert_to_jpg", "0") r.addBodyPara("needMorePrecise", "0") res = r.post() text = res.json()['showapi_res_body']['Result'] time.sleep(2) return text
def code_online(self): r = ShowapiRequest("http://route.showapi.com/184-4", "103444", "b8112ed5fc234f488fad6ef1d0c90ee1") # r.addBodyPara("img_base64", "") r.addBodyPara("typeId", "35") r.addBodyPara("convert_to_jpg", "0") r.addBodyPara("needMorePrecise", "0") r.addFilePara( "image", "C:/Users/xx/Desktop/SeleniumPython/register/test01.png") res = r.post() text = res.json()['showapi_res_body']['Result'] return text
# 画像の幅と高さを取得 right = code_element.size['width'] + left height = code_element.size["height"] + top # 画像を修理 # pip install Pillow from PIL import Image im = Image.open("imooc.png") img = im.crop((left, top, right, height)) img.save("imooc1.png") # (外部api使用した)画像の文字認識 r = ShowapiRequest("http://route.showapi.com/184-5", "my_appId", "my_appSecret") r.addBodyPara("img_base64", "") # typeid=画像内に数字の数 r.addBodyPara("typeId", "35") r.addBodyPara("convert_to_jpg", "0") r.addBodyPara("needMorePrecise", "0") r.addFilePara("image", "imooc1.png") #文件上传时设置 res = r.post() text = res.json()['showapi_res_body']["Result"] print(text) # 返回信息 # 認識した数字を入力 time.sleep(3) driver.find_element_by_id("captcha_code").send_keys(text) driver.close()