-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmy_util.py
More file actions
36 lines (28 loc) · 782 Bytes
/
my_util.py
File metadata and controls
36 lines (28 loc) · 782 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import json
import requests
from utils import get_data
def get_user_id(emp_no: str) -> str:
data = get_data()
url = data.get('EMP_ID_URL')
payload = {
"command": "TY-GR-002",
"params": {
"empShortId": emp_no
}
}
headers = {
'Content-Type': 'application/json',
'x-emp-no': emp_no,
'x-emp-id': '0',
'x-lang-id': 'zh_CN',
'x-tenant-id': '10000',
'User-Agent': data.get('EMP_USER_AGENT')
}
response = requests.request("POST", url, headers=headers, data=json.dumps(payload))
return json.loads(response.text).get('bo').get('empId')
#return data.get('EMP_ID')
def main():
return get_user_id('XXX')
if __name__ == '__main__':
res = main()
print(res)