我正在嘗試從 Azure AD 獲取個(gè)人資料圖像,并希望在 div 中顯示該圖像。我的服務(wù)器代碼如下,盡管我不確定如何在 div 中顯示該圖像。def account():token = _get_token_from_cache(app_config.SCOPE)if not token: return redirect(url_for("login"))graph_data = requests.get( # Use token to call downstream service app_config.ACCOUNT_INFO, headers={'Authorization': 'Bearer ' + token['access_token']}, ).json()#endpoint = '/users/firstname.lastname@somecompany.com/photo/$value'photo_responce = requests.get(app_config.PHOTO_ENDPOINT, headers={'Authorization': 'Bearer ' + token['access_token']},stream=True)photo_status_code = photo_responce.okif photo_status_code: photo = photo_responce.raw.read()else: photo = ''從這段代碼中,我獲取了照片的原始數(shù)據(jù),如下所示。b'\xff\xd8\xff\xe0\x00\x10JFIF\x00\x01\x01\x01\x00`\x00`\x00\x00\xff\xdb\x00C\x00\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\xff\xdb\x00C\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\x01\xff\xc0\x00\x11\x08\x02\x88\x02\x88\x03\x01"\x00\x02\x11\x01\x03\x11\x01\xff\xc4\x00\x1f\x00\x00\x01\x05\x01\x01\x01\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\xff\xc4\x00\xb5\x10\x00\x02\x01\x03\x03\x02\x04\x03\x05\x05\x04\x04\x00\x00\x01}\x01\x02\x03\x00\x04\x11\x05\x12!1A\x06\x13Qa\x07"q\x142\x81\x91\xa1\x08#B\xb1\xc1\x15R\xd1\xf0$3br\x82\t\n\x16\x17\x18\x19\x1a%&\'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz\x83\x84\x85\x86\x87\x88\x89\x8a\x92\x93\x94\x95\x96\x97\x98\x99\x9a\xa2\xa3\xa4\xa5\xa6\xa7\xa8\xa9\xaa\xb2\xb3\x我不知道如何轉(zhuǎn)換這些數(shù)據(jù)以便獲得圖像。這不是二進(jìn)制數(shù)據(jù)。請(qǐng)幫忙
添加回答
舉報(bào)
0/150
提交
取消