requests
library is used, to make HTTP requests in Pythonquote.py
script is used to generate random quotes by fetching them from public API endpoint
- Install python from here
- Install requests library using command :
pip install requests
The function generate_quote()
make GET request to the public API endpoint, extracts the data in json format and displays in randomly to the user. It handles error if any in the else
condition.
In text Format the output would be as follows :
Arnold Schwarzenegger - If you want to turn a vision into reality, you have to give 100% and never stop believing in your dream.
Any puplic API can be used for generating quotes, also datasets from Kaggle can also be imported and used.