Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions RandomQuotegenerator/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Reading a quote daily may boost you in different aspects. But, it will take time to surf the internet every day for quotes. So, how to save time?
I have created this automate that repeated process using Python.
This a project made usinh python. I have used the Quote Garden API to get a random quote.The project will give you random quotes every time you run the function.
22 changes: 22 additions & 0 deletions RandomQuotegenerator/randomquotegenerator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import requests


## function that gets the random quote
def get_random_quote():
try:
## making the get request
response = requests.get("https://quote-garden.herokuapp.com/api/v3/quotes/random")
if response.status_code == 200:
## extracting the core data
json_data = response.json()
data = json_data['data']

## getting the quote from the data
print(data[0]['quoteText'])
else:
print("Error while getting quote")
except:
print("Something went wrong! Try Again!")


get_random_quote()