美文网首页
python爬虫

python爬虫

作者: timar | 来源:发表于2019-06-20 15:48 被阅读0次

自动计算加班时间的小脚本
原文地址: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)

相关文章

网友评论

      本文标题:python爬虫

      本文链接:https://www.haomeiwen.com/subject/ezkjqctx.html