3

Whenever I try to get the answer of that POST request command, it returns only the first argument:

s = requests.post('https://martindarc59.typeform.com/app/form/result/token/AdHdvM/default')
print (s.text)

It should output this : enter image description here

However, I only get the token value and not the landed_at, I need both in my code to submit them at the end of my form.

Thank you !

2
  • How did you get the image? I'm also getting a single value rather than JSON when simply posting the link into my browser. Commented Apr 30, 2020 at 20:29
  • hello, when you enter the typeform the post request appears martindarc59.typeform.com/to/AdHdvM Commented Apr 30, 2020 at 20:31

1 Answer 1

3

You need to send the "Accept": "application/json" header, i.e.:

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'}
Sign up to request clarification or add additional context in comments.

6 Comments

Your demo doesn't work. Can you give an example of this request via Postman?
The original question url used on this answer is 404, but the example is valid for other urls
I tried other urls, it seems that now this solution does not work! Please check it out.
Try my survey: uza3fcl1odf.typeform.com/to/tCsWUtMB then the url should be like this: uza3fcl1odf.typeform.com/app/form/result/token/tCsWUtMB/default It doesn't work!
Open a new question and post the link here as a comment. I'll try to help you then.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.