From ba37a8c5b00bea9c97a6e4717e2f624d181ae7cd Mon Sep 17 00:00:00 2001 From: Varsha Gupta <89845598+varsha080@users.noreply.github.com> Date: Sun, 3 Oct 2021 20:34:45 +0530 Subject: [PATCH 1/2] Create randomquotegenerator.py --- RandomQuotegenerator/randomquotegenerator.py | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 RandomQuotegenerator/randomquotegenerator.py diff --git a/RandomQuotegenerator/randomquotegenerator.py b/RandomQuotegenerator/randomquotegenerator.py new file mode 100644 index 000000000..adbd1cf3c --- /dev/null +++ b/RandomQuotegenerator/randomquotegenerator.py @@ -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() From c7bb572148df4d8e5e031ea31ff12c16edd8832c Mon Sep 17 00:00:00 2001 From: Varsha Gupta <89845598+varsha080@users.noreply.github.com> Date: Sun, 3 Oct 2021 20:38:25 +0530 Subject: [PATCH 2/2] Create README.md --- RandomQuotegenerator/README.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 RandomQuotegenerator/README.md diff --git a/RandomQuotegenerator/README.md b/RandomQuotegenerator/README.md new file mode 100644 index 000000000..3db6ec2df --- /dev/null +++ b/RandomQuotegenerator/README.md @@ -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.