Class Quiz
import requests
url = "<https://reqres.in/api/users>"
information = {
"name": "python",
"job": "programmer"
}
response = requests.post(url,data=information)
print(response.content)
'''
{
"name":"python",
"job":"programmer",
"id":"481",
"createdAt":"2023-04-12T17:12:02.097Z"
}
'''
import requests
input = input("Enter user id:")
#<https://reqres.in/api/users/>
url = "<https://reqres.in/api/users/>"+str(input)
response = requests.get(url)
print(response.content)
import requests
import json
name = input("Please enter a name: ")
job = input("Please enter a job: ")
url = "<https://reqres.in/api/users>"
information = {
"name": name,
"job": job
}
response = requests.post(url,data=information)
response = json.loads(response.content)
print("Your account has been created!")
print("Your Name: "+response['name'])
print("Your Job: "+response['job'])
print("Your ID: "+ response['id'])
print("Your account has been created at : "+response['createdAt'])