add spider scheduler
Project description
添加调度
如何使用?
将config.json文件和excel文件放到和python代码在同一目录上。
config.json
{
"CN": {
"type": "mysql",
"host": "xxx",
"port": xx,
"user": "xx",
"password": "xx",
"db": "xx"
},
"US": {
"type": "mysql",
"host": "xxx",
"port": xx,
"user": "xxx",
"password": "xxx",
"db": "xxx"
}
}
main.py
from app_scheduler import Scheduler
'''
scheduler.set_cron(pub_code=pub_code, hours=2) # 120分钟调度一次
scheduler.set_cron(pub_code=pub_code, days=2) # 2天调度一次
scheduler.set_cron(pub_code=pub_code, minutes=5) # 5分钟调度一次
scheduler.set_encoding("utf-8", "listing") # 设置listing编码,需放在操作前
scheduler.set_encoding("utf-8", "content") # 设置content编码,需放在操作前
scheduler.output_sql() # 输出sql语句,需放在操作前
'''
if __name__ == '__main__':
choose_db = "cn"
excel_name = "insertFeeds.xlsx"
pub_code = "test"
scheduler = Scheduler(choose_db)
scheduler.output_sql()
scheduler.add_feed_pub(excel_name)
scheduler.set_cron(pub_code=pub_code, hours=2)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
app_scheduler-0.0.1.tar.gz
(5.7 kB
view hashes)
Built Distribution
Close
Hashes for app_scheduler-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7aabf4582ebc22fab637e838ceef60da7133aeea70d58090748794aed1fcc348 |
|
MD5 | 899c98921ff58ae5d8abed209555eca9 |
|
BLAKE2b-256 | 426ce56ece7b12533a74f593e41c225be78419d7acf083fbc5e47efc5615e9dc |