An application of using python to check notifications update for various campus website,and send SMS reminder,email reminder.
- Notification update SMS reminder
- Notification update email reminder
- Simultaneous reminders for multiple people
- Send log、check udate log
- log function optional
- The department which each user need to be reminded is optional
- Database storage/file storge
- Python
pip install twilio
- Using command to clone the the repository to local folder
git clone https://github.com/ZhaoQi99/School_Notice.git
- Apply for Twilio Free trial account
- Edit the
configs.py
file to modify the configuration file. - Run the
main.py
file
You can (and should) modify a couple of settings. if you do not need to use the twilio/Mail reminder feature, keep the default.
Fill in the sender's e-mail address, password, port, and SMTP server address in turn
FROM_ADDR = ""
PASSWORD = ""
EMAIL_PORT = 0
EMAIL_SERVER = ''
The following parameters can be found on the personal information page of the Twilio account.
ACCOUNT_ID = ''
AUTH_TOKEN = ''
TWILIO_NUMBER = ''
Content which is displayed in the window,including: school Name, script version, author name, author email
SCHOOL_NAME = ''
VERSION = ''
AUTHOR_NAME = ''
AUTHOR_EMAIL = ''
Whether logs can be logged in the log file, which is true by default
LOG_ENABLED = True
The type of storging data,including file storge,mysql storge
SAVE_TYPE = 'MYSQL'
SAVE_TYPE = 'File'
Whether show the information of copyright.
SHOW_RIGHT = False
Crawler configuration,including: department type (EN), department type (CN), "more notifications " page link, link public part, regular expression, Web page encoding format,type(notice/news)
department_EN: File name of data file
department_CN: Used to display in logs, message headers
Warning: There must be three groups in the regular expression, which the name must be link,date,title
Such as:info/1085/(?P<link>\d+\.htm)" target="_blank">(?P<title>[\s\S]{5,100})((?P<date>\d*-\d*-\d*))
SPIDER_CONFIG = [
{
'department_EN': '',
'department_CN': '',
'url': '',
'url_main': '',
'rule': '',
'coding': '',
'type': ''
},
{
'department_EN': '',
'department_CN': '',
'url': '',
'url_main': '',
'rule': '',
'coding': '',
'type': ''
}
]
Here is an example about crawler configuration:
SPIDER_CONFIG = [
{
'department_EN': 'snnu_index',
'department_CN': '学校主页',
'url': 'http://www.snnu.edu.cn/tzgg.htm',
'url_main': 'http://www.snnu.edu.cn/info/1085/',
'rule': 'info/1085/(?P<link>\d+\.htm)" target="_blank">(?P<title>[\s\S]{5,100})((?P<date>\d*-\d*-\d*))',
'coding': 'utf-8',
'type': '通知'
},
{
'department_EN': 'snnu_index',
'department_CN': '学校主页',
'url': 'http://www.snnu.edu.cn/sdxw.htm',
'url_main': 'http://www.snnu.edu.cn/info/1084/',
'rule': 'info/1084/(?P<link>\d+.htm)" target="_blank" title="(?P<title>[^"]+?)"><[^<]+?<[^<]+?<[^<]+?<p class="qh-wide-pushtime">(?P<date>\d*-\d*-\d*)',
'coding': 'utf-8',
'type': '新闻'
}
]
- Install pywin32
pip install pywin32
- Install Pyinstaller
pip install PyInstaller
- (optional)Move the program icon to the current folder, renamed ' Logo.ico
- Using
pyinstaller
package programpyinstaller -F main.py
Orpyinstaller -F -i logo.ico main.py
- Go to the Dist folder and you can see the Main.exe
cd dist
Thanks goes to these wonderful people (emoji key):
Keyi Xie 💻 📖 |
jhy 💻 📖 |
---|
- Author:Qi Zhao([email protected])
- License:GNU General Public License v3.0