1. - [yaml](#yaml)
  2. - [face_recognition](#face_recognition)
  3. - [获取token](#获取token)

result = yaml.safe_dump(d, encoding=’utf-8’, allow_unicode=True, default_flow_style=False) open(‘demo.yml’, ‘w’).write(result) ——————————————————————

save_yaml(‘teacher_info_list ‘, teacher_info_list)

with open(file_name+t+’.yaml’, mode=’w’) as f: yaml.dump(data, f)

  1. <a name="doMvh"></a>
  2. ##### face_recognition
  3. 人脸识别工具 直接调用这个函数就好
  4. <a name="Z4alM"></a>
  5. ##### 获取token

def get_token_emp(username, password): “””get_token_emp 获取token 判断是否获取成功, status_code=200 有返回值. 还需要做其他的操作. “”” token_api = ‘/connect/token’ data = { ‘client_id’: “video”, ‘client_secret’: “videosecrets”, ‘grant_type’: “password”, ‘username’: username, ‘password’: password, } r = do_post(api=token_api, data=data) if ‘access_token’ in r: return r[‘access_token’] else: return 0 def do_post(api, host=None, token=None, data=None): “””post构建,header构建,通用返回值判断 “”” host = emp_host url = ‘http://‘ + host + api headers = {} if token: headers = {‘Authorization’: ‘Bearer ‘ + token, # ‘Content-Type’: ‘application/json’ } result = re.post(url, data=data, headers=headers) if result.status_code != 200: print(“something went wrong”) return 0 return result.json() ```