API Test
Below is an API that displays famous motivational quotes and the author that said it. There is also code that my team added in that allows the user to give a rating of the quote from a scale from 1 to 10.
import requests
url = "https://motivational-quotes1.p.rapidapi.com/motivation"
payload = {
"key1": "value",
"key2": "value"
}
headers = {
"content-type": "application/json",
"X-RapidAPI-Key": "eac34bd148msh7c583e2672043f9p173fe7jsn8f992f4e7662",
"X-RapidAPI-Host": "motivational-quotes1.p.rapidapi.com"
}
response = requests.request("POST", url, json=payload, headers=headers)
print(response.text)
rating =int(input("Please rate the quote on a scale from 1 to 10"))
if rating <= 10 and rating >= 1:
print("You rated this quote", rating, "out of 10")
else:
print("Please have a rating between 1 and 10")