Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f31f0def29 | ||
|
|
36f6932bb7 | ||
|
|
b631b10ca6 |
+4
-1
@@ -1,9 +1,12 @@
|
|||||||
|
import logging
|
||||||
|
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
from loguru import logger
|
|
||||||
from starlette.requests import Request
|
from starlette.requests import Request
|
||||||
|
|
||||||
from app.api import api as api_router
|
from app.api import api as api_router
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
app = FastAPI(title='prayertimes',
|
app = FastAPI(title='prayertimes',
|
||||||
version='1.0.0',
|
version='1.0.0',
|
||||||
description='An API for fetching islamic prayer times from Presidency of Religious Affairs of Turkey')
|
description='An API for fetching islamic prayer times from Presidency of Religious Affairs of Turkey')
|
||||||
|
|||||||
+2
-2
@@ -21,7 +21,7 @@ class PrayerTimes(BaseModel):
|
|||||||
isha: str
|
isha: str
|
||||||
|
|
||||||
|
|
||||||
@cached(ttl=60*60, cache=Cache.MEMORY)
|
@cached(ttl=3*60*60, cache=Cache.MEMORY)
|
||||||
async def parse_prayer_times(url: str) -> List[PrayerTimes]:
|
async def parse_prayer_times(url: str) -> List[PrayerTimes]:
|
||||||
res = await _http.get(url)
|
res = await _http.get(url)
|
||||||
res.raise_for_status()
|
res.raise_for_status()
|
||||||
@@ -39,7 +39,7 @@ async def parse_prayer_times(url: str) -> List[PrayerTimes]:
|
|||||||
|
|
||||||
def make_location_url(location_id: int) -> str:
|
def make_location_url(location_id: int) -> str:
|
||||||
url = f'https://namazvakitleri.diyanet.gov.tr/en-US/{location_id}'
|
url = f'https://namazvakitleri.diyanet.gov.tr/en-US/{location_id}'
|
||||||
return f'https://proxy.abdusco.workers.dev?url={quote(url)}'
|
return url
|
||||||
|
|
||||||
|
|
||||||
async def get_prayer_times(location_id: int) -> List[PrayerTimes]:
|
async def get_prayer_times(location_id: int) -> List[PrayerTimes]:
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
beautifulsoup4==4.10.0
|
beautifulsoup4==4.10.0
|
||||||
fastapi==0.74.1
|
fastapi==0.74.1
|
||||||
httpx==0.22.0
|
httpx==0.22.0
|
||||||
loguru==0.6.0
|
|
||||||
uvicorn==0.17.5
|
uvicorn==0.17.5
|
||||||
aiocache==0.11.1
|
aiocache==0.11.1
|
||||||
Reference in New Issue
Block a user