Skip to main content

添加调度

如何使用?

将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)

Release files for app-scheduler 0.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for app-scheduler 0.0.1
File Size Uploaded
app_scheduler-0.0.1.tar.gz 5.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for app-scheduler 0.0.1
File Interpreter ABI Platform
app_scheduler-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.0 kB

Release files / app_scheduler-0.0.1.tar.gz

Download URL app_scheduler-0.0.1.tar.gz
Size 5.7 kB
Tags Source
SHA-256 checksum
How to use checksums
021956d1a6295cfae8df59d7e9d3febd03ca1449de59d9fd181b6079c3792432
BLAKE2b-256 checksum
How to use checksums
d3ba387c6c70e94962fe849283c5f492c08442a2b99065311f1c5bcebe229cb0
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / app_scheduler-0.0.1-py3-none-any.whl

Download URL app_scheduler-0.0.1-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7aabf4582ebc22fab637e838ceef60da7133aeea70d58090748794aed1fcc348
BLAKE2b-256 checksum
How to use checksums
426ce56ece7b12533a74f593e41c225be78419d7acf083fbc5e47efc5615e9dc
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page