This Python script generates a random verse from the Bhagavad Gita using the Bhagavad Gita API. It selects a random chapter and verse number, makes a GET request to the API, and displays the verse text.
- Python 3.x
requests
library (install usingpip install requests
)
-
Clone the repository:
git clone https://github.com/your_username/your_repository.git
-
Change to the project directory:
cd your_repository
-
Install the required
requests
library:pip install requests
Run the Python script using the following command:
python random_verse.py
The script will generate a random chapter and verse number, make a request to the Bhagavad Gita API, and display the selected verse.
To use the Bhagavad Gita API, you need an API key. Follow the steps below to obtain one:
- Visit the RapidAPI Bhagavad Gita API page.
- Sign up for a RapidAPI account (if you don't have one).
- Subscribe to the Bhagavad Gita API and obtain your API key.
- Replace the placeholder API key in the Python script with your actual API key.
"X-RapidAPI-Key": "your_api_key",
"X-RapidAPI-Host": "bhagavad-gita3.p.rapidapi.com"
}
Make sure to keep your API key secure and avoid committing it to version control.
Contributions are welcome! If you have any suggestions or improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License.