python_wiki:requests

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
python_wiki:requests [2018/08/09 23:34]
billdozor [POST]
python_wiki:requests [2018/08/09 23:37]
billdozor [POST]
Line 116: Line 116:
 import requests import requests
  
 +# Post the request (this will delay/sleep for 5 seconds)
 response = requests.post("http://httpbin.org/delay/5") response = requests.post("http://httpbin.org/delay/5")
 +
 +# Extract the JSON object from the response
 +data = response.json()
 + 
 +# Show http status code
 +print("Status code is:" + str(response.status_code))
 +
 +print("Returned response is:")
 +print(data)
 </code> </code>
  
 ---- ----
  
  • python_wiki/requests.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)