Metadata-Version: 2.1
Name: app-scheduler
Version: 0.0.1
Summary: add spider scheduler
Home-page: https://gitee.com/gan_jian_wen_main/scheduling-library
Author: ganjianwen
Author-email: 1727949032@qq.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE.txt

# 添加调度
## 如何使用?
<p>将config.json文件和excel文件放到和python代码在同一目录上。</p>

### config.json

```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

```python
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)

```





