Skip to main content

A Python library for managing time and displaying Persian (Jalali) calendar events and daily supplications.

Project description

TimeBaran Library

TimeBaran is a Python library that provides functionality for working with Persian (Jalali) dates, times, daily supplications, and upcoming events. It allows you to retrieve the current time in Persian format, fetch events for the current date, and more.

Features

  • Get Current Persian Time: Retrieve the current time in Persian (Jalali) format, including year, month, day, and time.
  • Daily Supplications: Get a daily supplication based on the current date.
  • Upcoming Events: Fetch upcoming events for the month in Persian, with descriptions.

Installation

You can install the library via pip by using the following command:

pip install timebaran

Requirements

  • pytz for time zone support.
  • jdatetime for working with Persian (Jalali) dates.
  • requests for making HTTP requests.
  • BeautifulSoup for web scraping and parsing event data.
  • tzlocal for determining the local timezone.

Usage

To use the Date_time class in your project, you can follow the example below:

from TimeBaran import Date_time

# Initialize the Date_time object
dt = Date_time()

# Get the upcoming events
events = dt.get_events()
print(events)

# Get the current time, day, supplication, and events
time_data = dt.get_time()
print(time_data)

get_time() Method

This method returns the current time and date in Persian (Jalali) format, along with:

  • time_now: Current time in HH:MM:SS format.
  • time_h: Hour of the current time.
  • time_m: Minute of the current time.
  • time_s: Second of the current time.
  • date_now: Current date in Persian (Jalali) format (YYYY/MM/DD).
  • time_year: Year part of the current date in Persian.
  • time_month: Month part of the current date in Persian.
  • time_day: Day part of the current date in Persian.
  • day_of_week: Current day of the week in English short form (e.g., Mon, Tue).
  • zekr_today: Daily supplication based on the current day.
  • events: A dictionary of upcoming events with dates as keys and descriptions as values.

get_events() Method

This method fetches upcoming events from a public website and returns them in a dictionary format.

Example:

{
    '5 Esfand': 'روز بزرگداشت خواجه نصیرالدین طوسی',
    '7 Esfand': 'سالروز استقلال کانون وکلای دادگستری',
    # More events...
}

License

This library is open-source and distributed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

timebaran-0.0.2.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

timebaran-0.0.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file timebaran-0.0.2.tar.gz.

File metadata

  • Download URL: timebaran-0.0.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for timebaran-0.0.2.tar.gz
Algorithm Hash digest
SHA256 70ac065dcda2f4a5e500433932e47dd2dbdc798e48766627a5b8e3f3ca5386d1
MD5 0f1cb7c6b3c6da2dd8fdf64d81106898
BLAKE2b-256 5274daea37ef340f669286d838f6d13c5e4607c1fb53779d7eee4a8c64fa7ea5

See more details on using hashes here.

File details

Details for the file timebaran-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: timebaran-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.1

File hashes

Hashes for timebaran-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 91b2bda402008cd6b82d2e955d57cb5699d0eb7d349ba8e0190c5f1a152d5241
MD5 f16c456986710bf8deae413eca74b60c
BLAKE2b-256 785624385aed8a34616798ee4f57a49e802ae1e3c366d0645bcab760e03c710f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page