我正尝试在烧瓶中发送发布请求。在烧瓶中发送发布请求
我想发送带有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
有3个属性,'header','param'和'data'。要设置标题变量像'content-type',你应该在标题 –