Skip to main content

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


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)

Uploaded Source

Built Distribution

app_scheduler-0.0.1-py3-none-any.whl (6.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page