https://github.com/theawiteb/quran_suras_api
https://github.com/theawiteb/quran_suras_api
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/theawiteb/quran_suras_api
- Owner: TheAwiteb
- License: gpl-3.0
- Created: 2021-06-21T21:52:46.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2021-06-21T21:55:53.000Z (about 5 years ago)
- Last Synced: 2025-04-07T01:43:22.397Z (about 1 year ago)
- Language: Python
- Size: 13.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
quran_suras_API
The API is based on the quran_suras library
requirements
•
Installation
•
Features
•
Usage
•
License
## requirements
**>= python3.7**
## Installation
```bash
# Installation
git clone https://codeberg.org/Awiteb/quran_suras_API
# Run
cd quran_suras_API
pip3 install -r requirements.txt
python3 app.py
```
## Features
* Access to all [quran_suras](https://pypi.org/project/quran-suras) library functions
## Usage
**get surah by number:**
```python
import requests
url = "http://127.0.0.1:8000/get_sura_by_number/?sura_number={}&amount={}"
sura_number = 2
amount = 1
suras = requests.get(url.format(sura_number, amount)).json()
print(suras)
```
Example Result
```json
{'ok': True,
'result': [{'reader': 'أحمد الحذيفي',
'url': 'https://server8.mp3quran.net/ahmad_huth/002.mp3'}],
'sura_name': 'البقرة'}
```
**get surah by name:**
```python
import requests
url = "http://127.0.0.1:8000/get_sura_by_name/?sura_name={}&amount={}"
sura_name = 'الفرقان'
amount = 1
suras = requests.get(url.format(sura_name, amount)).json()
print(suras)
```
Example Result
```json
{'ok': True,
'result': [{'reader': 'أحمد الحواشي',
'url': 'https://server11.mp3quran.net/hawashi/025.mp3'}],
'sura_name': 'الفرقان'}
```
**get surah name by number:**
```python
import requests
url = "http://127.0.0.1:8000/get_sura_name/?sura_number={}"
sura_number = 33
sura_name = requests.get(url.format(sura_number)).json()
print(sura_name)
```
Example Result
```json
{'name': 'الأحزاب', 'ok': True}
```
**get surah number by name:**
```python
import requests
url = "http://127.0.0.1:8000/get_sura_number/?sura_name={}"
sura_name = 'الناس'
sura_number = requests.get(url.format(sura_name)).json()
print(sura_number)
```
Example Result
```json
{'number': 114, 'ok': True}
```
**get page from quran by page number:**
```python
import requests
url = "http://127.0.0.1:8000/get_page/?page_number={}"
page_number = 7
page = requests.get(url.format(page_number)).json()
print(page)
```
Example Result
```json
https://www.mp3quran.net/api/quran_pages_arabic/601.png{'page_url': 'https://www.mp3quran.net/api/quran_pages_arabic/007.png', 'ok': True}
```
**get radios by language:**
```python
import requests
url = "http://127.0.0.1:8000/get_radios/?language={}&amount={}"
language = 'ar'
amount = 1
radios = requests.get(url.format(language, amount)).json()
print(radios)
```
Example Result
```json
{'language': 'ar', 'result': [{'name': '---تراتيل قصيرة متميزة---', 'url': 'http://live.mp3quran.net:9702/'}], 'ok': True}
```
## LICENSE
[GPLv3](https://www.gnu.org/licenses/gpl-3.0.html)