2
나는 다음과 같은 코드가 있습니다 그러나게시물 통화에서 파일 데이터 전송
email = '[email protected]'
avatar = open('/Users/david/Desktop/a.png').read()
data = {
'email': email,
'avatar': avatar
}
body = json.dumps(data)
requests.post(url, headers=headers, data = body)
, 나는 다음과 같은 JSON 오류 얻을 일을 시도 :
UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 0: invalid start byte
가 어떻게 파일 데이터를 보낼 것을 이리?