Skip to content

Commit 08c0cf3

Browse files
authored
Merge pull request #352 from TaniaMalhotra/quotes
Random quote generator added
2 parents cdb021f + 4fb882d commit 08c0cf3

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

Python/quotes/README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Random inspirational quotes generator
2+
3+
## Aim
4+
Aim fo the script is to generate random quotes everytime script is run
5+
6+
## To use
7+
```python script.py```

Python/quotes/quote.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import requests
2+
from json import loads
3+
# makijng get request to forismatic API
4+
response = requests.get('http://api.forismatic.com/api/1.0/?method=getQuote&format=json&lang=en')
5+
# printing the response of quote text and quoteAuthor
6+
print("Hey there! This is the quote for the day")
7+
## extracting name and author
8+
print('{quoteText} - {quoteAuthor}'.format(**loads(response.text)))

0 commit comments

Comments
 (0)