Skip to content

Unofficial Timeir API based-on FastAPI and Python. ⏰ 🚀

Notifications You must be signed in to change notification settings

MosTafa2K/timeir_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Timeir Unofficial API ⏰🚀

An efficient and unofficial API to interact with time.ir and fetch calendar and quote information.

Overview 🔎

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.

Features ✨

  • Get current date in formats:
    • Solar
    • Lunar
    • Gregorian
  • Get a random quote text with it's author

Prerequisites 🛠️

  • Python >= 3.9.x
  • pytest
  • pytest-asyncio
  • FastAPI
  • BeautifulSoup
  • httpx
  • uvicorn

Note: You can easily install all requirement packages just using pdm install or pip install -r requirements.txt

Install pdm 📥

pip install pdm

Run ⚡

First create virtual environment:

python -m venv venv

Active venv:

Windows

venv\Scripts\activate

Linux

venv\bin\activate

Then:

Go to main directory:

cd src\timeir_api\

Excecute using uvicorn :

uvicorn main:app --reload

Example Usage 💡

Here is a simple example of how to fetch the current date:

curl -X GET "http://127.0.0.1:8000/api/v1/date/current"

Expected response:

{
    "date": {
        "solar": "سه شنبه - ۱۳ شهریور  ۱۴۰۳",
        "gregorian": "Tuesday - 2024 03 September",
        "lunar": "الثلاثاء - ٢٩ صفر ١٤٤٦"
    }
}

License 🧾

This project is licensed under the MIT License.

About

Unofficial Timeir API based-on FastAPI and Python. ⏰ 🚀

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages