Skip to Content
ExamplesPython

Python

This standard-library example needs no HTTP dependency:

from json import loads from urllib.parse import urlencode from urllib.request import urlopen params = urlencode( { "latitude": 25.2048, "longitude": 55.2708, "timezone": "Asia/Dubai", "date": "2026-09-18", "calculation_method": "iacad_dubai", "fajr_adjustment": 2, } ) with urlopen(f"https://api.aakashsharma.com.np/api/v1/prayer-times?{params}") as response: payload = loads(response.read()) print(payload["calculated_times"]["fajr"]) print(payload["azan_times"]["fajr"])

For production clients, handle HTTPError and parse its JSON response so that INVALID_TIMEZONE, range errors, and VALIDATION_ERROR details can be presented clearly to users.

For local development, replace https://api.aakashsharma.com.np with http://127.0.0.1:8000.

Last updated on