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 details)
Built Distribution
File details
Details for the file app_scheduler-0.0.1.tar.gz
.
File metadata
- Download URL: app_scheduler-0.0.1.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 021956d1a6295cfae8df59d7e9d3febd03ca1449de59d9fd181b6079c3792432 |
|
MD5 | 60b568cc2d9af41a000a18ace0fccfca |
|
BLAKE2b-256 | d3ba387c6c70e94962fe849283c5f492c08442a2b99065311f1c5bcebe229cb0 |
File details
Details for the file app_scheduler-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: app_scheduler-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7aabf4582ebc22fab637e838ceef60da7133aeea70d58090748794aed1fcc348 |
|
MD5 | 899c98921ff58ae5d8abed209555eca9 |
|
BLAKE2b-256 | 426ce56ece7b12533a74f593e41c225be78419d7acf083fbc5e47efc5615e9dc |