import
requests
import
json
import
time
def
login():
session
=
requests.session()
url_get
=
'https://xiaobei.yinghuaonline.com/prod-api/captchaImage'
response
=
session.get(url_get)
uuid
=
response.json()[
'uuid'
]
showcode
=
response.json()[
'showCode'
]
url_post
=
'https://xiaobei.yinghuaonline.com/prod-api/login'
data
=
{
"username"
: "",
"password"
: "",
"code"
: showcode,
"uuid"
: uuid
}
response
=
session.post(url
=
url_post, json
=
data)
token_xiaobei
=
response.json()[
'token'
]
url_tiwen
=
"https://xiaobei.yinghuaonline.com/prod-api/student/health"
headers
=
{
'user-agent'
:
'iPhone10,6(iOS/13.5.1) Uninview(Uninview/1.0.0) Weex/0.26.0 1125x2436'
,
'authorization'
: token_xiaobei,
'accept-encoding'
:
'gzip, deflate, br'
}
data
=
{
"temperature"
:
"36.3"
,
"coordinates"
:
"undefined-陕西省-西安市-雁塔区"
,
"location"
:
"108.8814949544271,34.21714735243056"
,
"healthState"
:
"1"
,
"dangerousRegion"
:
"2"
,
"dangerousRegionRemark"
: "",
"contactSituation"
:
"2"
,
"goOut"
:
"1"
,
"goOutRemark"
: "",
"remark"
: "",
"familySituation"
:
"1"
}
response
=
requests.post(url
=
url_tiwen, headers
=
headers, json
=
data)
print
(response.text)
if
__name__
=
=
'__main__'
:
login()