Python - 抓驗證碼
======================================
#import cv2
import requests
import shutil
from IPython.display import Image
rs = requests.session()
res=rs.get('https://fbfh.trade.gov.tw/rich/text/common/code_98/CheckImageCode.aspx',stream=True,verify=False)
with open ('check.png','wb') as f :
shutil.copyfileobj (res.raw,f)
#img1 = cv2.imread('D:\\PythonData\\check.jpg',cv2.IMREAD_COLOR)
#img2 = cv2.imread('C:\\Users\\User\\Desktop\\banana.jpg',cv2.IMREAD_COLOR)
#img3 = cv2.imread('C:\\Users\\User\\Desktop\\check.jpg',cv2.IMREAD_COLOR)
#cv2.imshow('My Image', img)
#cv2.waitKey(0)
#cv2.destroyAllWindows()
Image('check.png')
payload = {'queryType':'C',
'basic_select':'2',
'chinese_name':'台北',
'ccc_select':'1',
'textcheckCode':''}
res = rs.post('https://fbfh.trade.gov.tw/rich/text/indexfbol.asp',data=payload,verify='false')
res.encoding = 'utf-8'
print (res.text)
=================================