python http response code example
Example 1: create a response object in python
from requests.models import Response
the_response = Response()
the_response.code = "expired"
the_response.error_type = "expired"
the_response.status_code = 400
the_response._content = b'{ "key" : "a" }'
print(the_response.json())
Example 2: http client post python
import requests
pload = {'username':'Olivia','password':'123'}
r = requests.post('https://httpbin.org/post',data = pload)
print(r.text)
Example 3: python response
import requests
response = request.get('https://abc.com')
print(response.[the response attribute])
response.status_code
response.json()
response.text