We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents a679e85 + 6aeebcd commit fa156deCopy full SHA for fa156de
RandomQuoteGenerator/README.md
@@ -0,0 +1,7 @@
1
+ Packages Used
2
+
3
+```
4
+pip install requests
5
6
7
+API used : Quote Garden
RandomQuoteGenerator/random-quote.py
@@ -0,0 +1,22 @@
+import requests
+## function that gets the random quote
+def get_random_quote():
+ try:
+ ## making the get request
8
+ response = requests.get("https://quote-garden.herokuapp.com/api/v3/quotes/random")
9
+ if response.status_code == 200:
10
+ ## extracting the core data
11
+ json_data = response.json()
12
+ data = json_data['data']
13
14
+ ## getting the quote from the data
15
+ print(data[0]['quoteText'])
16
+ else:
17
+ print("Error while getting quote")
18
+ except:
19
+ print("Something went wrong! Try Again!")
20
21
22
+get_random_quote()
0 commit comments