Skip to content
This repository was archived by the owner on Aug 28, 2023. It is now read-only.

Commit 8fb7186

Browse files
committed
New v5 (Alpha) Update
1 parent fe52480 commit 8fb7186

File tree

7 files changed

+37
-9
lines changed

7 files changed

+37
-9
lines changed

README.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ _Learn more about Adhan in [Wikipedia](https://en.wikipedia.org/wiki/Adhan)_
1919
- No API keys, authentication, or registration required.
2020
- Converting the JSON responses to Python objects.
2121
- 3 Location methods: Coordinates, City, and Address.
22+
- More Adhan metadata made by the module, such as the number of rakat in salah, sunnan al rawatib rakat number, is hijri or secret salah, etc.
2223

2324
<br>
2425

@@ -46,17 +47,27 @@ See the [Wiki](https://www.github.com/Kh4lidMD/AlAdhan/wiki)
4647

4748
# Versioning
4849

49-
v4.1.0 (Alpha) **Latest**
50+
v5.0.0 (Alpha) **Latest**
51+
52+
- Set `threaded_wait` default argument in the `Adhan.wait` method from `True` to `False`.
53+
- Added missing file `aladhan/exceptions.py` to the repository. which was included in the package but not in the repository.
54+
- Changed `RateLimitException` to `RateLimitedException` (typo fix).
55+
- Added `sunnan_al_rawatib` function to the `Adhan` object, returns a dictionary with `before` and `after` keys, each one contains the sunnan al rawatib rakat number.
56+
- _[English Source](https://www.wikihow.com/Pray-Sunnah-Prayers)_
57+
- _[Arabic Source](https://mawdoo3.com/%D9%85%D8%A7_%D9%87%D9%8A_%D8%B3%D9%86%D9%86_%D8%A7%D9%84%D8%B5%D9%84%D8%A7%D8%A9_%D8%A7%D9%84%D9%85%D8%A4%D9%83%D8%AF%D8%A9)_
58+
- Added `__version__` attribute to the `aladhan` module, a version tuple like `(major, minor, patch)`.
59+
60+
v4.1.0 (Alpha)
5061

5162
- Added custom exceptions especially for the following return codes:
52-
- 400 Bad Request error: `BadRequestException`
53-
- 429 Rate limited error: `RateLimitedException`
54-
- 500 Internal Server error: `ServerErrorException`
63+
- 400 bad request error: `BadRequestException`
64+
- 429 rate limited error: `RateLimitedException`
65+
- 500 internal server error: `ServerErrorException`
5566

5667
_They're avaialble in the `aladhan.exceptions`, could be directly imported from the `aladhan` module._
5768
- New Wiki page: [Exception Handling](https://www.github.com/Kh4lidMD/AlAdhan/wiki/Exception-Handling)
5869

59-
_Started to save a copy of the Wiki pages in every release._
70+
_Started to save a copy of the Wiki pages in every release._
6071

6172
v4.0.0 (Alpha)
6273

aladhan/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
from .client import Aladhan
22
from .location_types import City, Address, Coordinates
33
from .exceptions import *
4+
5+
__version__ = (5, 0, 0)

aladhan/adhan.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def readable_timing(self, show_time=True, show_date=True, _24h=False, arabic=Fal
6464
else:
6565
return self.datetime_obj.strftime(format_)
6666

67-
def wait(self, callback=None, threaded_wait=True, **kwargs):
67+
def wait(self, callback=None, threaded_wait=False, **kwargs):
6868
"""
6969
Wait until the salah time has passed.
7070
@@ -128,5 +128,17 @@ def get_name(self, lang='en') -> str:
128128
else:
129129
return self.name
130130

131+
def sunnan_al_rawatib(self) -> dict:
132+
"""
133+
Returns a dictionary with the number of sunnah prayers `before` and `after` the salah.
134+
"""
135+
136+
if self.name == 'Fajr': return {'before': 2,'after': 0}
137+
elif self.name == 'Dhuhr': return {'before': 4, 'after': 2}
138+
elif self.name == 'Asr': return {'before': 0, 'after': 0}
139+
elif self.name == 'Maghrib': return {'before': 0, 'after': 2}
140+
elif self.name == 'Isha': return {'before': 0, 'after': 2}
141+
142+
131143
def __str__(self):
132144
return f'{self.name} at {self.readable_timing()}'

aladhan/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ def __get_endpoint_by_location(location: Union[Coordinates, Address, City], endp
5151
@staticmethod
5252
def __detect_exceptions(response: requests.Response, data: dict):
5353
if response.status_code == 429:
54-
raise RateLimitException("Rate limit exceeded.")
54+
raise RateLimitedException("Rate limit exceeded.")
5555
if response.status_code == 400:
5656
raise BadRequestException(data['data'])
5757
if response.status_code == 500:

aladhan/exceptions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class RateLimitedException(Exception):pass
2+
class BadRequestException(Exception):pass
3+
class ServerErrorException(Exception):pass

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[metadata]
2-
description-file = README.md
2+
description-file = README.md

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setup(
77
name="aladhan-api",
8-
version="4.1.0",
8+
version="5.0.0",
99
author="Khaled Mahmoud",
1010
author_email="[email protected]",
1111
description="A Python package to calculate Islamic prayer times for any location in the world.",

0 commit comments

Comments
 (0)