1234567891011121314151617181920212223242526272829 |
- import requests
- import dataset
- import time
- import pymysql
- pymysql.install_as_MySQLdb()
- # from ga_click import main
- headers = {
- "Authorization": "Bearer " + "OZDcq7sVKwr3F6YNLtBF3LuIgpa4Ql9eAnBWeD7sHTJ",
- "Content-Type": "application/x-www-form-urlencoded"
- }
- def send_msg(d):
- params = {"kw數量": d}
- print('通知結果', params)
- # r = requests.post("https://notify-api.line.me/api/notify", headers=headers, params=params)
- db = dataset.connect('postgresql://postgres:eyJhbGciOiJI@172.105.241.163:5432/postgres')
- d = {'啟翔':0,'加百裕':0,'富玉':0,'信義房屋':0}
- cursor = db.query("select * from public.seo")
- for c in cursor:
- if c['cust'] in d.keys():
- d[c['cust']]+=1
- send_msg(d)
|