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
import requests
import dataset
import time
import sys
import docker
import pymysql
pymysql.install_as_MySQLdb()
from GA_all import main


ga_info = {'有夠讚':['208868237',{
        "Authorization": "Bearer " + "Alur8iUgifYsh9CMiyUdlrTWK4Y9Xys8RZD52YkBMGl",
        "Content-Type": "application/x-www-form-urlencoded"
},'c:\gitlab\kw_tools\monitor\corded-velocity-301807-a0d690cd59d9.json'],
        '新飛':['195216524',{"Authorization": "Bearer " + "ZfOUonutteqyFGfcx8jsHo9LoaTKL8oJ3WLwQamzN6c",
        "Content-Type": "application/x-www-form-urlencoded"},'C:\gitlab\kw_tools\monitor\corded-velocity-301807-f43006dd42c8.json'],
        '極簡乳清':['141324760',{"Authorization": "Bearer " + "DC7eiXkGoKzXcuCTuqCGmuNnDC15D3iv6E7tu5BAsUZ",
        "Content-Type": "application/x-www-form-urlencoded"},'C:\gitlab\kw_tools\monitor\corded-velocity-301807-879b27e60620.json'],
        '美麗馨':['282939758',{"Authorization": "Bearer " + "4RO6ZOS4b7TkuqknajBPibTnOYnumHfwJvRzdZ3Bmq6",
        "Content-Type": "application/x-www-form-urlencoded"},'C:\gitlab\kw_tools\monitor\corded-velocity-301807-c1a87c5dfc8d.json'],
}

def send_msg(viewid,header,key_file):
    send_message = main(viewid, key_file)
    params = {"message": send_message['message']}
    print('通知結果',params)
    r = requests.post("https://notify-api.line.me/api/notify",headers=header, params=params)


# for k,v in ga_info.items():
# send_msg(v[0],v[1],v[2])
send_msg('195216524',{"Authorization": "Bearer " + "DC7eiXkGoKzXcuCTuqCGmuNnDC15D3iv6E7tu5BAsUZ",
        "Content-Type": "application/x-www-form-urlencoded"},"C:\/Users\/s1301\/Downloads\/corded-velocity-301807-f43006dd42c8.json")

# schtasks /create /sc minute /mo 30 /sd 2022/05/050 /st 9:00 /et 23:00 /tn "linebat" /tr "C:\tmp\inn_line.bat"

SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(SCRIPT_DIR))