seo_notify_gs.py 727 B

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