Skip to main content

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.

Release files for TimeBaran 0.0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for TimeBaran 0.0.3
File Size Uploaded
timebaran-0.0.3.tar.gz 4.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for TimeBaran 0.0.3
File Interpreter ABI Platform
timebaran-0.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 9.9 kB

Release files / timebaran-0.0.3.tar.gz

Download URL timebaran-0.0.3.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ae7601c264b781a1b3bb9630e2487187641dbd9adf9f585eac17661a825ba6c7
BLAKE2b-256 checksum
How to use checksums
404343a7e4c22358de957abd88ab57abf3a9d4b925f9b0cbb63e1fd05a9064c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release files / timebaran-0.0.3-py3-none-any.whl

Download URL timebaran-0.0.3-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c75fcba2b0af383645eb9dd9962842322e8d3faf37e0931a5b92fa5dbd46e74f
BLAKE2b-256 checksum
How to use checksums
186ec997238f3969639bfb9d2792d2c160db959c32dd440a26279f7ccbdf382a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.1

Release history Release notifications | RSS feed

This release

0.0.3 This release

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page