📅  最后修改于: 2023-12-03 15:29:36.968000             🧑  作者: Mango
The Bible API is a web-based API that provides developers with access to various biblical texts. This API is built using RESTful principles and allows developers to retrieve specific passages or sections of the Bible in multiple translations and languages.
Multiple Translations: Bible API supports multiple translations of the Holy Bible, including King James Version, New International Version, and New American Standard Bible.
Multi-Language Support: The API currently supports multiple languages, including English, Spanish, Chinese, and French.
Custom Search: Developers can retrieve specific Bible passages using parameters such as passage, book, chapter, and verse.
Unrestricted Access: The Bible API is free to use and does not require any authentication or registration.
Bible API Base URL: https://bible-api.com
Retrieve Passage: /api/<version>/<passage>
Example: https://bible-api.com/KJV/John%203:16
Retrieve Passage with Translation and Language: /api/<version>/<passage>?translation=<translation>&language=<language>
Example: https://bible-api.com/KJV/John%203:16?translation=niv&language=es
Retrieve Random Passage: /api/<version>/random
Example: https://bible-api.com/KJV/random
Response to each API request returns a JSON object with the following properties:
import requests
url = "https://bible-api.com/KJV/John%203:16?translation=niv&language=es"
response = requests.get(url)
data = response.json()
print(f"Reference: {data['reference']}")
print(f"Content: {data['content']}")
print(f"Translation: {data['translation']}")
print(f"Language: {data['language']}")
Example Output:
Reference: John 3:16
Content: Porque de tal manera amó Dios al mundo, que ha dado a su Hijo unigénito, para que todo aquel que en él cree, no se pierda, mas tenga vida eterna.
Translation: New International Version
Language: Spanish
Note:
The above code snippet shows how to retrieve a passage from the Bible API using Python. The response data is then printed to the console in markdown format for easy readability.