Skip to content

Commit

Permalink
Update clock-in.py
Browse files Browse the repository at this point in the history
  • Loading branch information
vtu81 authored Jul 8, 2022
1 parent d93af27 commit 86e4785
Showing 1 changed file with 14 additions and 9 deletions.
23 changes: 14 additions & 9 deletions clock-in.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import datetime
import time
import sys
import ddddocr
# import ddddocr


class ClockIn(object):
Expand All @@ -34,7 +34,7 @@ def __init__(self, username, password):
self.username = username
self.password = password
self.sess = requests.Session()
self.ocr = ddddocr.DdddOcr()
# self.ocr = ddddocr.DdddOcr()

def login(self):
"""Login to ZJU platform"""
Expand Down Expand Up @@ -69,12 +69,12 @@ def get_date(self):
today = datetime.date.today()
return "%4d%02d%02d" % (today.year, today.month, today.day)

def get_captcha(self):
"""Get CAPTCHA code"""
resp = self.sess.get(self.CAPTCHA_URL)
captcha = self.ocr.classification(resp.content)
print("验证码:", captcha)
return captcha
# def get_captcha(self):
# """Get CAPTCHA code"""
# resp = self.sess.get(self.CAPTCHA_URL)
# captcha = self.ocr.classification(resp.content)
# print("验证码:", captcha)
# return captcha

def get_info(self, html=None):
"""Get hitcard info, which is the old info with updated new time."""
Expand Down Expand Up @@ -117,7 +117,12 @@ def get_info(self, html=None):
new_info['jcqzrq'] = ""
new_info['gwszdd'] = ""
new_info['szgjcs'] = ""
# new_info['verifyCode'] = self.get_captcha()

# 2022.05.07
# new_info['verifyCode'] = self.get_captcha() # 验证码识别(已取消)

# 2022.07.05
new_info['internship'] = 3 # 今日是否进行实习或实践

# 2021.08.05 Fix 2
magics = re.findall(r'"([0-9a-f]{32})":\s*"([^\"]+)"', html)
Expand Down

0 comments on commit 86e4785

Please sign in to comment.