An open API service indexing awesome lists of open source software.

https://github.com/theawiteb/quran_suras_api


https://github.com/theawiteb/quran_suras_api

Last synced: 9 months ago
JSON representation

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)