def send_Line(self, token): text = self.report() for k, tk in token.items(): messenger = Sendline(tk) messenger.sendtext(text) print('Sent to :' + k)
if founddot == True: allpost.append(txt) # print(txt) # print('------------------') founddot = False if txt == '·': founddot = True return allpost from songline import Sendline token = '0MDrgIKGY9aET3Xxsy01cAfkY1hoxIoqfRgLpDj4GLR' messenger = Sendline(token) for i in range(100000): messenger.sendtext('รักเทอๆ') checkTwitter = ['elonmusk', 'BillGates'] for ct in checkTwitter: texttoline = '' post = TwitterPost(ct) print("----- {} -----".format(ct)) texttoline += '----- {} -----\n'.format(ct) for p in post: texttoline += p + '\n\n' print("==========") messenger.sendtext(texttoline) driver.close()
from flask import Flask from binance.client import Client from songline import Sendline from apscheduler.schedulers.background import BackgroundScheduler try: from config_dev import API_BINANCE_KEY, API_BINANCE_SECRET, API_LINE_TOKEN except Exception: from config_prod import API_BINANCE_KEY, API_BINANCE_SECRET, API_LINE_TOKEN #+++ Start Connection +++ app = Flask(__name__) api_key = API_BINANCE_KEY api_secret = API_BINANCE_SECRET client = Client(api_key, api_secret) token = API_LINE_TOKEN lineNoti = Sendline(token) sched = BackgroundScheduler(daemon=True) #+++ End Connection +++ def signal_by_ema(symbols): try: #print("In Coin : " + symbols) #klines = client.get_historical_klines(symbols, Client.KLINE_INTERVAL_30MINUTE , "120 minutes ago UTC") #klines = client.get_historical_klines(symbols, Client.KLINE_INTERVAL_30MINUTE, "860 minutes ago UTC") klines = client.get_historical_klines(symbols, Client.KLINE_INTERVAL_1HOUR, "250 hours ago UTC") closes = [float(i[4]) for i in klines] closes = np.array(closes) if len(closes) > 0:
# bot-songline.py # การใช้งานโปรแกรมส่งไลน์ # 1-ออก token เว็บไซต์ https://notify-bot.line.me/my/ # 2-กด generate token > ตั้งชื่อบ็อท > เลือกกลุ่ม > generate token # 3-เปิด cmd/terminal > pip install songline # 4-พิมพ์ตามโค้ดด้านล่างนี้ from songline import Sendline token = 'WHnwgNxrI29Od6jCMfjGYsZGXyD8YMNj4xmEFOl55qK' messenger = Sendline(token) #messenger.sendtext('สวัสดีจ้าาาาา') #messenger.sticker(100,1) messenger.sendimage( 'https://s359.kapook.com/pagebuilder/04761904-54c7-46ed-aba3-72ae8eebcd9e.png' )
'NGV' ] oilprice = [] for ol in todayprice: oilprice.append(ol.text) result = {} for t, o in zip(oiltitle, oilprice): result[t] = o print(result) from songline import Sendline token = 'yGl16EdhlgZflBpsZbtPTcn3En9uk33ZeRNvotlChWi' messenger = Sendline(token) count = 1 for res, value in result.items(): if count == 1: messenger.sendtext('ราคาน้ำมัน ' + res + value) count += 1 else: messenger.sendtext('ราคา ' + res + ' วันนี้: ' + value + ' บาท') response = messenger.sticker(12, 1) print(response) time.sleep(4000)
from ccxt.ftx import ftx from songline import Sendline import ccxt import pandas as pd import json import time token = 'put your line token' messenger = Sendline(token) ############################ Setting ############################################# API_Key = 'put your api key' API_secret = 'put your api secret' Subaccount = 'put your subaccount name' Pair = "SRM/USD" Token_name = "SRM" Rebalance_value = 1000 ## put your rebalance value ## ############################### เรียกใช้งาน API ############################################# FTX = ccxt.ftx({ 'apiKey' : API_Key , 'secret' : API_secret , 'headers': {'FTX-SUBACCOUNT': 'put your subaccount name'}, 'enableRateLimit': True }) print(messenger.sendtext('Exchange = ' + str(FTX))) ## Network checking / Line notify ## ################################# Price of SRM #############################################
#testline.py from songline import Sendline # pip install songline token = 'bgClpKkgX4c4o0k0pAMLmd7pfSgSotcGpHAF0tT8N43' messenger = Sendline(token) messenger.sendtext('สวัสดีจ้าาาา') messenger.sticker(3, 1, 'บิทคอยราคาต่ำแล้ว! 5000 บาทต่อเหรียญ') messenger.sendimage( 'https://www.altcoinbuzz.io/wp-content/uploads/2018/10/Ontwerp-zonder-titel-4.png' )
color: #F6E207; padding-left:25px;' class='strokeme'>28.2 °C</TD> ''' # <span class="title" > กรุงเทพมหานคร</span> province = data.find_all('span', {'class': 'title'}) province = province[0].text province = province.strip() temp = data.find_all('td', {'class': 'strokeme'}) temp = temp[0].text # .text เป็นคำสั่งที่ใช้ในการตัด tag ออก #print(province, temp) return 'จังหวัด: {} อุณหภูมิ: {}'.format(province, temp) alltext = '' #เอาไว้สะสมข้อความ for i in range(20, 40): #สั่งรันตัวเลช 1-10 ออกมาเพื่อเป็น ID ของจังหวัด try: text = Temperature(i) #เช็คอุณหภูมิ alltext = alltext + text + '\n' #เอาผลลัพท์ที่เช็คได้ไปบวกกับค่าเก่า except: print('Not found') print(alltext) # ได้ข้อความทั้งหมดแล้วก็ทำการส่ง Line from songline import Sendline token = 'xm4K7kqtfU1yfybWQUm2GDLhxZYOeVAQCssssoUeYMpK7HP' messenger = Sendline(token) messenger.sendtext(alltext)
# metar-tafs-manual.py # https://paetalung.github.io/cv/ # Send line Section from songline import Sendline token = '' # VTSE-WEATHER # Insert METARS or TAFs Here metar = "test na ja" metar = metar + "\n" messenger = Sendline(token) messenger.sendtext(metar)
#Path for MAC PATH_MAC = '/Users/TopBook/Google Drive/CODE/AUTORUN/' covid19_thai = Covid19_thai(url_2, PATH_MAC + 'covid19-thai-recorded.csv') # print( covid19_thai.report()) token_all = { "user1 (ตังเอง)": '< user 1 - Token >', "ีuser2": '< please insert Token >', "user3": '< please insert Token >', "user4": '< please insert Token >', "user5": '< please insert Token >' } chk, dmm = covid19_thai.check_change() covid19_thai.get_patient_url_2() if (chk == False): token = {"user1 (ตังเอง)": '< please insert Token >'} covid19_thai.send_Line(token) messenger = Sendline(token["user1 (ตังเอง)"]) messenger.sendtext("The program is running...") print("The program is running...") elif (chk): # covid19_thai.send_Line( token_all ) print("Send to ALL ") covid19_thai.update_to_csv(chk)
from songline import Sendline token = 'RnraCw5OSzn492JJ2OSL39p4oIkVvrBAtGCk4IkbQRE' messenger = Sendline(token) #messenger.sendtext() #Pull data checktwitter = ['elonmask', 'BillGates', 'cnnbrk', 'SpaceX'] for ct in checktwitter: TextToLine = '' post = TwitterPost(ct) print('--------------- {} -------------'.format(ct)) TextToLine += '--------------- {} -------------\n'.format(ct) for p in post: print(p) TextToLine += p + '\n\n' #TextToLine = TextToLine + p print('=========') messenger.sendtext(TextToLine) driver.close()
def write_data_point2(): '''' 10 นาที = 2 จุด 15 นาที = 3 จุด 20 นาที = 4 จุด 25 นาที = 5 จุด 30 นาที = 6 จุด ''' # กำหนดตัวแปรจำนวนจุด conti = Continuously content = request.get_json() temperature = content['temperature'] humidity = content['humidity'] node_name1 = content['node'] dateTime = content['dateTime'] print(f'temp={temperature}') print(f'hu={humidity}') print(f'node={node_name1}') print(f'dateTime ={dateTime}') nodes = Node_SetUp.query.filter_by(node=node_name1) len_ab_temp=[] no_de=node_name1 for n in nodes: time_alert = int(n.time_alert) #เวลาเป็นาทีที่เลือกให้เตือน print(f'time_alert ={time_alert}, type = {type(time_alert)}') count = time_alert / 5 int_count=int(count) print(f'int_count ={int_count}, type = {type(int_count)}') t_h_alert = n.temp_hight_alert t_l_alert = n.temp_low_alert # temp = Temp_data.query.filter_by(node_name1=n.node).order_by(Temp_data.id.desc()) e = n.staff.email.split(",") #แบ่งอีเมลของแต่ละคนออกมาเป็น list now = datetime.datetime.now() min_time_alert = datetime.timedelta(minutes=time_alert) print(f'now = {now}') print(f'min_time_alert = {min_time_alert}') diff_time = (now - min_time_alert) print(f'diff_time = {diff_time}') email = e user =n.staff.username try: temp = Temp_data.query.filter(Temp_data.dateTime >= diff_time).filter(Temp_data.dateTime <= now) for t in temp: last_ab_temp=t.ab_temp[-1] messenger = Sendline(token) print(f'n.node={node_name1}') messenger.sendtext(f'อุณหภูมิของ {node_name1} ขณะนี้เท่ากับ {t.ab_temp} องศาเซลเซียส กรุณาตรวจสอบ') # for t in temp: # print(f't.ab_temp = {t.ab_temp}:{len(t.ab_temp)}') # print(len(t.ab_temp)) # if len(t.ab_temp) >= count: # print(f't.ab_temp = {t.ab_temp}') # send_email_alert(email,user,no_de,t.ab_temp) # else: # print('No No No') except: pass # send_email_alert(email,user,no_de,tempss) return addData(dateTime,humidity,node_name1,temperature)
time_today = str(currentDT.strftime("%Y-%m-%d %H:%M:%S")) text_ = 'ขณะนี้มียอดผู้ป่วย Covid19 ในประเทศไทยที่ยืนยันแล้ว \nจำนวน ' + covid_num + ' คน \nข้อมูลวันที่ ' + time_today print(text_) last_covid19 = int(last_covid19) covid_num = int(covid_num) if (covid_num > last_covid19): text_ = text_ + '\nมียอดผู้ป่วยเพิ่มขึ้น : ' + str(covid_num - last_covid19) + ' คน' messenger = Sendline(token_me) messenger.sendtext(text_) messenger = Sendline(token_line_group) messenger.sendtext(text_) elif (covid_num < last_covid19): text_ = text_ + '\nมียอดผู้ป่วยลดลง: ' + str(last_covid19 - covid_num) + ' คน' messenger = Sendline(token_me) messenger.sendtext(text_) messenger = Sendline(token_line_group) messenger.sendtext(text_)
from urllib.request import urlopen as req from bs4 import BeautifulSoup as soup url = "https://ddc.moph.go.th/viralpneumonia/" webopen = req(url) pange_html = webopen.read() webopen.close() data = soup(pange_html, 'html.parser') temp = data.findAll('h4', {'class': 'txt'}) result = temp[0].text result1 = temp[1].text result2 = temp[2].text result3 = temp[3].text print('ผู้ติดเชื้อสะสม: {} ผู้ติดเชื้อวันนี้: {} รุนแรง: {}: เสียชีวิต {}'. format(result, result1, result2, result3)) from songline import Sendline token = 'clO63p0RQzYzYit1teVQvt6WNIRCvJnWZtWZ2x36xa0' messenger = Sendline(token) messenger.sendtext( 'ผู้ติดเชื้อสะสม: {}ผู้ติดเชื้อวันนี้: {} รุนแรง: {}: เสียชีวิต {}'.format( result, result1, result2, result3))
# alert to line # https://github.com/UncleEngineer/songline from songline import Sendline token = 'ZDXWM1wd3IhrbZjeq882GXgIBk8OnRk8qFDklLPXn7c' messenger = Sendline(token) '''# test sending messenger.sendtext('สวัสดีจ้าา มีออร์เดอร์ 1000 รายการ') messenger.sticker(14,1,'')'''
from songline import Sendline token = 'FM9m4KGs9rsVRzpTEZCGwdbQn5WcBOGE6CDElqSV3fF' messenger = Sendline(token) messenger.sendtext('Hi, how are you?') #send text messenger.sticker(8, 1) #send sticker messenger.sendimage( 'https://post.greatist.com/wp-content/uploads/sites/3/2020/02/322868_1100-1100x628.jpg' ) #send picture
# Specify URL to scrape url = 'https://www.worldometers.info/coronavirus/country/' + Country # Get data in html format page_html = requests.get(url).text # Beautify data from html source data = soup(page_html, 'html.parser') # Get number of new cases new_date = data.findAll('div', {'class': 'news_date'}) new_case = data.findAll('li', {'class': 'news_li'}) new_cases = new_case[0].text.replace('[source]', '') total = new_date[0].text + ': ' + new_cases # Close website return total except: return 'No Result' # Send message to LINE messaging app from songline import Sendline token = '{Enter your LINE token here}' #COVID BOT Group in LINE App messenger = Sendline(token) messenger.sendtext(Scraping('australia')) messenger.sendtext(Scraping('new-zealand'))
#driver = webdriver.Chrome() # create driver url = 'https://meteogram.org/sun/thailand/chumphon/' driver.get(url) # open web time.sleep(3) # waiting 3 sec page_html = driver.page_source driver.close() data = soup(page_html,'html.parser') # scan data #print(data) table = data.find('span',{'id':'sunset'}) #print(table) out = str(table) # index on data out = out.replace("<span id=\"sunset\">","") out = out.replace("</span>","") #print(out) # Send line Section from songline import Sendline token = 'XXXXXXXXXXX' # TEST sunset = "SUNSET @ " + out messenger = Sendline(token) messenger.sendtext(sunset)
data = soup(page_html, 'html.parser') #scan data table = data.findAll('table', {'id': 'tbData'}) table = table[0].findAll('tbody') rows = table[0].findAll('tr') todayprice = rows[0].findAll('td') #print(todayprice) oiltitle = [ 'วันที่', 'Diesel Premium', 'Diesel', 'DieselB10', 'DieselB20', 'Benzene', 'Gasohol95', 'Gasohol91', 'GasoholE20', 'GasoholE85', 'NGV' ] oilprice = [] for ol in todayprice: oilprice.append(ol.text) result = {} for t, o in zip(oiltitle, oilprice): result[t] = o print(result) from songline import Sendline token = '1K37reP1tOCJfUjDdtjEb5sLjyjJth8TFVXkVvJR3Cj' messenger = Sendline(token) messenger.sendtext('ราคาดีเซลวันนี้: ' + result['Diesel'] + ' บาท') messenger.sticker(12, 1)
from songline import Sendline token = '9Z2zvpB9saTwIWlJyMwt6Vz7Dk5jQGS9CC6oCmL97br' messenger = Sendline(token) #messenger.sendtext('สั่งสินค้าปืน 2 กระบอก') #messenger.sticker(14,1,'ลูกค้าสั่งสินค้า 10000 บาท') messenger.sendimage('https://theonebbgun.com/wp-content/uploads/2018/06/Ares-AM007-black-01-600x600.jpg')
founddot = False if txt == '·': founddot = True return allpost ################################# from songline import Sendline token = 'XBl8ulCzgdiir5q4wzd48gd43TVxunOq71FGHRZDRHf' messenger = Sendline(token) #messenger.sendtext() checktwitter = ['elonmusk','BillGates','cnnbrk','SpaceX'] for ct in checktwitter: texttoline = '' post = TwitterPost(ct) print('---------- {} ------------'.format(ct)) texttoline += '---------- {} ------------\n'.format(ct) for p in post: print(p) texttoline += p + '\n\n' # texttoline = texttoline + p print('=====')
driver.get(url) # open web time.sleep(3) # waiting 3 sec page_html = driver.page_source driver.close() data = soup(page_html,'html.parser') # scan data #print(data) table = data.find('td',{'id':'sunrise'}) #print(table) out = str(table) # index on data out = out.replace("<td id=\"sunrise\">","") out = out.replace("</td>","") out = out.replace("<span>","") out = out.replace("</span>","") out = out.replace("<strong>","") out = out.replace("</strong>","") #print(out) # Send line Section from songline import Sendline token = 'XXXXXXXXXX' # TEST sunrise = "SUNRISE @ " + out messenger = Sendline(token) messenger.sendtext(sunrise)
from songline import Sendline token = 'vqCTCOy5oJv7QV4v4P69uqzqj60lJ4F4I74eimsNcEF' messenger = Sendline(token) balance = 1000 Fix_value = 1000 BTC_value = 1000 if BTC_value < Fix_value: amount = Fix_value - BTC_value print(messenger.sendtext('Buy BTC ' + str(amount))) elif BTC_value > Fix_value: amount = BTC_value - Fix_value print(messenger.sendtext('Sell BTC ' + str(amount))) else: print(messenger.sendtext('Do notihng'))
# pip install songline from songline import Sendline token = 'xm4K7kqtfU1yfybWQUm2GDLhxZYOesssVAQCoUeYMpK7HP' messenger = Sendline(token) #messenger.sendtext('สวัสดีจ้าาา') #messenger.sticker(404,1,'ถูพื้นด่วน!') img = 'https://s359.kapook.com/pagebuilder/0ecae544-6e7b-4f8d-a0f8-1b0e2200a0c3.png' #messenger.sendimage(img)
# print('server time: ',time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(1347517370))) # convert server time to local time checktext = checkCondition(ticker) if len(checktext)>0: textLine += checktext messenger.sendtext(textLine) time.sleep(0.5) # 0.5sec checkPrice() ### ========= main ========= API_HOST = 'https://api.bitkub.com' # base URL token = tkn.TOKEN # line to me messenger = Sendline(token) # send message btc = 'THB_BTC' eth = 'THB_ETH' marketTicker = requests.get(API_HOST+'/api/market/ticker') # all coin in board ticker = marketTicker.json() # change to dictionary(json) btcValue = ticker[btc]['last'] ethValue = ticker[eth]['last'] usdtValue = ticker['THB_USDT']['last'] bnbValue = ticker['THB_BNB']['last'] bandValue = ticker['THB_BAND']['last'] dogeValue = ticker['THB_DOGE']['last'] # value_list = [btcValue,ethValue,usdtValue,bnbValue,bandValue,dogeValue] value_list = [btcValue]
# import package from songline import Sendline token = 'm7wHTQVaFdLju5MHW4rQgLpXSBaOMRcylCyRdwXzTvJ' messenger = Sendline(token) #messenger.sendtext('ไม่วู้') #messenger.sticker(173,2) img = 'https://static.posttoday.com/media/content/2017/11/23/35B73BCDE4784DB6836C26E43BF54395_1000.jpg' messenger.sendimage(img)
from songline import Sendline token = 'YnC15ij9ilV76PuK8A8W2GEUbUFlAaTP3DU6eazEVBA' messager = Sendline(token) # messager.sendtext('Hello World') messager.sticker(300, 4)