An efficient and unofficial API to interact with time.ir and fetch calendar and quote information.
The Timeir API is an unofficial API for interacting with the time.ir website and fetching information from it. This API can be easily integrated into any Python project requiring date or quote information from time.ir.
- Get current date in formats:
- Solar
- Lunar
- Gregorian
- Get a random quote text with it's author
- Python >= 3.9.x
- pytest
- pytest-asyncio
- FastAPI
- BeautifulSoup
- httpx
- uvicorn
Note: You can easily install all requirement packages just using
pdm install
orpip install -r requirements.txt
pip install pdm
First create virtual environment:
python -m venv venv
Windows
venv\Scripts\activate
Linux
venv\bin\activate
Go to main directory:
cd src\timeir_api\
Excecute using uvicorn
:
uvicorn main:app --reload
curl -X GET "http://127.0.0.1:8000/api/v1/date/current"
{
"date": {
"solar": "سه شنبه - ۱۳ شهریور ۱۴۰۳",
"gregorian": "Tuesday - 2024 03 September",
"lunar": "الثلاثاء - ٢٩ صفر ١٤٤٦"
}
}