您好,每当我尝试获取该post request命令的答案时,它仅返回第一个参数:
s = requests.post('https://martindarc59.typeform.com/app/form/result/token/AdHdvM/default')
print (s.text)
它应该输出以下内容: enter image description here
但是,我只获得令牌值,而不是“ landed_at”,因此我需要在代码中同时将它们都提交到表单末尾。 谢谢 !
答案 0 :(得分:2)
您需要发送"Accept": "application/json"
标头,即:
import requests
u = "https://martindarc59.typeform.com/app/form/result/token/AdHdvM/default"
j = requests.post(u, headers={"Accept": "application/json"}).json()
# {'token': '20903331626f396431746f397777693832713331626f39643136747572367978706434313339363936363463366336363533373434333536343134353337366237613339343233303664373236613737353935613431363436393336343833313335333833383332333733393336333333373633653233363637346132653432343938383963326537663165326535633262373837326336613437343539666638653932613131393266386236393635626131353838323739363337', 'landed_at': '1588279637'}