- 基本上,會幫你做到兩件事
- Step1: 更改 .env.example 成 .env,並且修改內部內容
- QRCODE_LINK = XXX -> XXX 改成資策會提供的連結
- NAME = XXX -> XXX 改成你的姓名
- GMAIL_SENDER_EMAIL = XXX -> XXX 改成你的寄信 Email
- GMAIL_RECEIVER_EMAIL = XXX -> XXX 改成改成你的收信 Email
- GMAIL_PASSWORD = XXX -> XXX 改成下面教學拿到的密碼
- 因為會使用到 Google 的 Gmail ,所以要去申請自己 Gmail 權限的密碼
- 教學 - 下半部
- Webex
- WEBEX_NAME = XXX -> XXX 改成你的姓名
- WEBEX_EMAIL = XXX -> XXX 改成你的信箱
- Step2:
- 記得安裝 dotenv, requests, bs4(BeautifulSoup), webdriver套件
- 下載 Chromedriver,並放在根目錄
- Step3: 使用 crontab
- Usage:
# Create my_cron.txt and put the following text in my_cron.txt vim my_cron.txt 0 9 * * 1-5 /usr/bin/python ~/sign/signIn.py >> ~/sign/cron.log 2>&1 30 13 * * 1-5 /usr/bin/python ~/sign/signIn.py >> ~/sign/cron.log 2>&1 # Apply crontab crontab my_cron.txt # To make sure it works crontab -l
- crontab 確認
- crontab test by crontab-0900
- crontab test by crontab-1330
- Mac 使用 crontab 排錯
- Usage:
- 先說:沒打到卡與我無關XD
- 純方便打卡使用,要自己確定有打到卡。
- 建議可以在收信時確認是否收到正確的時間,是的話才真正有打到卡!
- 確認如下:(紅色匡起來是打卡時間)