使用python進行企業微信報警

2021-09-06 08:12:37 字數 1192 閱讀 2345

先獲取企業id:ww1245127892d933e6

獲取應用的secrect:srn0qkb5j209k_ufm15rjff0apkqpwzghb51c - ehqcs

1.獲取 access toke

import requests

get_token_url_template =

''get_token_url = get_token_url_template.

format

( id=

'ww1245127892d933e6'

, secrect=

'srn0qkb5j209k_ufm15rjff0apkqpwzghb51c-ehqcs'

)

傳送請求,並得到 相應物件
r_token = requests.get(url=get_token_url)
得到相應的資訊 字典的型別
token_dic = r_token.json(

)token = token_dic.get(

'access_token'

)

2. 使用 資訊傳送的 api 進行傳送資訊

具體訊息

text_content =
定義發現的訊息體
data_body =

,"safe":0

# 是否加密傳輸: 0 不加密 1 加密

}

import json
傳送資訊的 url
send_msg_url =

''

使用 post 方法開始傳送資訊
r = requests.post(

url=send_msg_url.

format

(token)

,# 把獲取到的 token 格式化進來

json=data_body # 傳送的訊息體

)print

(r.status_code)

# 返回的狀態碼

print

(r.text)

# 返回的內容

python之企業微信log日誌收集及報警

往往在很多時候 跑著跑著就出現bug了,那麼我們怎樣能及時發現bug及修復bug呢?呼叫api之前需要獲取乙個token def get token self 根據api獲取token corpid 獲取到的企業id corpsecret 應用的secret url values req reque...

python 企業微信 報警

class wechat 後期 可以把 access token 放入資料庫中 過期時間為倆小時 def init self,corpid,corpsecret,agentid,touser self.corpid corpid self.corpsecret corpsecret self.age...

python 工資條 企業微信 企業微信工資條開發

1.行業及競爭對手研究 3.現狀詳細診斷 4.seo優化診斷報告 5.外部鏈結及反鏈建設 6.優化seo執行 7.日常seo優化諮詢 8.公司網路營銷及seo培訓 4.企業對優化的需求 必須首頁還是整站優化?5.企業 seo現狀 是否降權被k,程式是否值得優化。1.了解行業.檢查 出 優化方案及se...