1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 |
- import redis
- import time
- import json
- from selenium import webdriver
- from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
- import time
- import os
- import urllib.parse
- from selenium.webdriver.support.ui import WebDriverWait
- from selenium.webdriver.common.by import By
- from selenium.webdriver.support import expected_conditions as EC
- import codecs
- import random
- from bs4 import BeautifulSoup
- import requests
- import dataset
- import time
- import rpyc
- import sys
- import docker
- headers = {
- "Authorization": "Bearer " + "eEVYaouu4zJUWdfCwRn8e0G9bnsbemmUNnIJY8LL1Lw",
- "Content-Type": "application/x-www-form-urlencoded"
- }
- import subprocess
- batcmd="dir"
- import rpyc
- import os
- conn = rpyc.classic.connect("192.168.192.139",18812)
- conn.execute('import subprocess')
- rsub = conn.modules.subprocess
- result = rsub.check_output('docker ps |grep alpine-poi | wc -l', shell=True)
- alston1="alston1:"+result.decode('utf-8').strip()
- conn = rpyc.classic.connect("192.168.192.43",18812)
- conn.execute('import subprocess')
- rsub = conn.modules.subprocess
- result = rsub.check_output('docker ps |grep alpine-poi | wc -l', shell=True)
- alston2="alston2:"+result.decode('utf-8').strip()
- #sys.exit()
- #ros.system('docker restart 62eab82f7759')
- #print('after restart')
- #time.sleep(11)
- #print('after wait')
- def send_msg(kw):
- params = {"message": kw}
- r = requests.post("https://notify-api.line.me/api/notify",headers=headers, params=params)
- db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/google_poi?charset=utf8mb4')
- cursor=db.query('SELECT count(*) as cnt FROM google_poi.shop_list3;')
- cnt=''
- for c in cursor:
- cnt=str(c['cnt'])
- #result="\n"
- #idx=0
- #for c in cursor:
- # idx+=1
- # if idx<=3:
- # elmt=c['kw'].split(' ')[0]
- # result+="["+str(c['ranking'])+"]:"+elmt+"\n"
- #msg="\n機器人執行次數:"+str(idx)
- msg="shop_list3: "+cnt+"\n"
- msg+=alston1+"\n"
- msg+=alston2
- send_msg(msg)
|