requests python check status 200 code example
Example 1: check if response is 200 python
if resp.status_code == 200:
print ('OK!')
else:
print ('Boo!')
Example 2: check if response is 200 python
from datetime import datetime
my_dates = ['5-Nov-18', '25-Mar-17', '1-Nov-18', '7-Mar-17']
my_dates.sort(key=lambda date: datetime.strptime(date, "%d-%b-%y"))
print(my_dates)