自动计算加班时间的小脚本
原文地址:https://www.cnblogs.com/chenxiaohan/p/7654667.html
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import io
import requests
import json
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
data = {
"userLoginName":"",
"userPwd":""
}
url = "http://xxxx/signIn.do"
session = requests.Session();
resp = session.post(url, data)
print(resp.content.decode("utf-8"))
attDelayUrl = "http://xxxx/attDelayApplayCfg.do?method=query"
data1 = {
"page":"0",
"pagesize":"20",
"qryAdaBeginDate":"2019-05-01",
"qryAdaEndDate":"2019-05-31",
"qryAdaStatus":"",
"qryUserId":"",
"ciContractType":"",
"qryBranch":"",
"qryPbiSupplierNo":"",
"qryAuthMan":"",
}
resp1 = session.post(attDelayUrl, data1)
# print(resp1.content.decode("utf-8"))
jsonStr = json.loads(resp1.text)
attDelays = jsonStr["attDelayApplayCfgColl"]
hours = 0.0
for j in attDelays:
hours += float(j["adaHours"])
print(hours)
网友评论