# 匯入模組
from wxpy import *
# 初始化機械人,掃碼登陸
bot = bot()
#author_='zhi';
#date: 2020/6/20 0020 13:34
from __future__ import unicode_literals
from threading import timer
from wxpy import *
import requests
import random
bot = bot()
# linux執行登陸請呼叫下面的這句
# bot = bot(console_qr=2,cache_path="botoo.pkl")
def get_news():
"""獲取金山詞霸每日一句,英文和翻譯"""
url = ""
r = requests.get(url)
content = r.json()['content']
note = r.json()['note']
return content, note
def send_news():
try:
contents = get_news()
my_friend = bot.friends().search('小智')[0]
my_friend.send(contents[0])
my_friend.send(contents[1])
my_friend.send(u"晚安")
# 每86400秒(1天),傳送1次
t = timer(86400, send_news)
# 為了防止時間太固定,於是決定對其加上隨機數
ran_int = random.randint(0, 100)
t = timer(86400 + ran_int, send_news)
t.start()
except:
my_friend = bot.friends().search('小智哥')[0]
my_friend.send(u"今天訊息傳送失敗了")
if __name__ == "__main__":
send_news()
python 每天定時給女友傳送「土味情話」簡訊
前提 需要一台伺服器,一點點python基礎。目前採用的方法 伺服器定時任務 twilio的簡訊服務 天行資料的土味情話介面 twilio的服務的好處是測試賬號免費給認證號碼發簡訊,而且不需要模板,國內的簡訊服務都需要審核模板,用起來不是十分方便,同樣的 還有nexmo 1,註冊twilio賬號,建...
用Python每天自動給女友免費發簡訊
目錄 今天的教程就是教大家怎麼傳送免費簡訊給女朋友。傳送簡訊介面,我知道的常見的有兩個平台,乙個是 twilio,可以免費發簡訊 500 條,可發任意資訊,乙個是騰訊雲,可以免費發簡訊 100 條,需要申請簡訊傳送內容模板。鑑於 twilio 免費次數多一些,所以,這次我們就 twilio來傳送當天...
教你使用python實現微信每天給女朋友說晚安
但凡一件事,稍微有些重複。我就考慮怎麼樣用程式來實現它。這裡給各位程式設計師朋友分享如何每天給朋友定時微信傳送 晚安 故事,新聞,等等 最好執行在伺服器上,這樣後台掛起來更方便。準備 pip install wxpy pip install wechat sender pip install req...