ZhaoQi99 / School_Notice

应用Python对校园各类网站的通知更新进行短信,邮件提醒。(An application of using python to check notifications update for various campus website,and send SMS reminder,email reminder.)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Language: 🇺🇸 🇨🇳

School_Notice


Build Status Release License GitHub forks GitHub stars

Introduction

An application of using python to check notifications update for various campus website,and send SMS reminder,email reminder.

features

  • 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

Dependencies

Using script

  1. Using command to clone the the repository to local folder git clone https://github.com/ZhaoQi99/School_Notice.git
  2. Apply for Twilio Free trial account
  3. Edit the configs.py file to modify the configuration file.
  4. Run the main.py file

Configuration

You can (and should) modify a couple of settings. if you do not need to use the twilio/Mail reminder feature, keep the default.

Send Email Config

Fill in the sender's e-mail address, password, port, and SMTP server address in turn

FROM_ADDR = ""
PASSWORD = ""
EMAIL_PORT = 0
EMAIL_SERVER = ''

Twillo Config

The following parameters can be found on the personal information page of the Twilio account.

ACCOUNT_ID = ''
AUTH_TOKEN = ''
TWILIO_NUMBER = ''

Show Config

Content which is displayed in the window,including: school Name, script version, author name, author email

SCHOOL_NAME = ''
VERSION = ''
AUTHOR_NAME = ''
AUTHOR_EMAIL = ''

Log Config

Whether logs can be logged in the log file, which is true by default

LOG_ENABLED = True

Save Type Config

The type of storging data,including file storge,mysql storge

SAVE_TYPE = 'MYSQL'
SAVE_TYPE = 'File'

Show Right Config

Whether show the information of copyright.

SHOW_RIGHT = False

Spider Config

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:

Example

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': '新闻' 
    }
]

Packaging exe(Windows)

  1. Install pywin32 pip install pywin32
  2. Install Pyinstaller pip install PyInstaller
  3. (optional)Move the program icon to the current folder, renamed ' Logo.ico
  4. Using pyinstaller package program pyinstaller -F main.pyOrpyinstaller -F -i logo.ico main.py
  5. Go to the Dist folder and you can see the Main.exe cd dist

Contributors

Thanks goes to these wonderful people (emoji key):


Keyi Xie

💻 📖

jhy

💻 📖

License & Author

About

应用Python对校园各类网站的通知更新进行短信,邮件提醒。(An application of using python to check notifications update for various campus website,and send SMS reminder,email reminder.)

License:GNU General Public License v3.0


Languages

Language:Python 100.0%