플라스크에서 게시물 요청을 보내려고합니다.플라스크에서의 게시물 요청 전송
Content-Type: application/json
으로 json 개체를 헤더로 보내고 싶습니다. 다음과 같이
나는 요청 모듈을이 일을 해요 :
json_fcm_data = {"data":[{'key':app.config['FCM_APP_TOKEN']}], "notification":[{'title':'Wyslalem cos z serwera', 'body':'Me'}], "to":User.query.filter_by(id=2).first().fcm_token}
json_string = json.dumps(json_fcm_data)
print json_string
res = requests.post('https://fcm.googleapis.com/fcm/send', json=json_string)
을하지만이 나 있습니다 :
TypeError: request() got an unexpected keyword argument 'json'
이 문제를 해결하는 방법에 대한 조언은?
패스'데이터 = json_string' –
그러나 "콘텐츠 형식 : 응용 프로그램/JSON"을 설정합니까 : 전체 솔루션이 될 것인가? – demoo
'headers','param' 및'data'의 세 가지 속성이 있습니다. 'content-type'과 같은 헤더 변수를 설정하려면 header 속성에 추가해야합니다. –