情境演練#03 國民身分證領補換資料查詢作業

這個禮拜的文章是做內政部的 國民身分證領補換資料查詢作業 的自動化情境演練,根據政府的 Open Data 資料,這個網站是中華民國政府的網站中被查詢次數最高的服務,由於它使用較為複雜的驗證碼來阻止流程機器人查詢,若您公司還是有需求要對身份證查詢作業進行自動化,本篇文章就會很符合您的需要,我們會手把手教您使用 Power Automate 來將這部份的作業自動化哦!
完整教學影片

以下為操作步驟補充說明:
步驟一. Anti-Captcha 服務申請:
請使用以下網址進行 Anti-Captcha 服務申請: http://getcaptchasolution.com/seduaclqey
步驟二. 安裝完成 Python 3.9 以後,請在命令提示符號輸入以下兩行指令:
  • C:\temp>pip install anticaptchaofficial
  • C:\temp>pip install Pillow
請將分隔線中間的內容複製起來,另存為名稱 anti-captcha.py 的檔案並且放置在 c:\temp 路徑中,詳細操作請見教學影片。
=======我是分隔線=============

from anticaptchaofficial.imagecaptcha import *
from PIL import Image
solver = imagecaptcha()
solver.set_key("please_input_your_anticaptcha_key")
image = Image.open('C:\\temp\captcha.jpg')
image = image.crop((500,1010,735,1110))
#編碼小幫手 使用的螢幕解析度為 1920X1200, 有可能在其他螢幕擷取尺寸會有差異,請自行調整截圖範圍
#格式為((x1,y1,x2,y2))
image.save('c:\\temp\captca_crop.jpg',"JPEG")
captcha_text = solver.solve_and_return_solution('c:\\temp\captca_crop.jpg')
if captcha_text != 0:
print(captcha_text)
else:
print("task finished with error "+solver.error_code)

=======我是分隔線=============
請使用以下網址 開啟身份證換發網站:
https://www.ris.gov.tw/apply-idCard/app/idcard/IDCardReissue/main