BusinessOpeningHours¶
- class telegram.BusinessOpeningHours(time_zone_name, opening_hours, *, api_kwargs=None)[source]¶
Bases:
telegram.TelegramObjectThis object describes the opening hours of a business.
Objects of this class are comparable in terms of equality. Two objects of this class are considered equal, if their
time_zone_nameandopening_hoursare equal.Available In
Added in version 21.1.
- Parameters:
time_zone_name (
str) – Unique name of the time zone for which the opening hours are defined.opening_hours (Sequence[
telegram.BusinessOpeningHoursInterval]) – List of time intervals describing business opening hours.
- time_zone_name[source]¶
Unique name of the time zone for which the opening hours are defined.
- Type:
str
- opening_hours[source]¶
List of time intervals describing business opening hours.
- Type:
Sequence[
telegram.BusinessOpeningHoursInterval]
- get_opening_hours_for_day(date, time_zone=None)[source]¶
Returns the opening hours intervals for a specific day as datetime objects.
Added in version 22.5.
- Parameters:
date (
datetime.date) – The date to get opening hours for.time_zone (
datetime.tzinfo|str, optional) – Timezone to use for the returned datetime objects. If not specified, thentime_zone_namebe used.
- Returns:
A tuple of datetime pairs representing opening and closing times for the specified day. Each pair consists of
(opening_time, closing_time). Returns an empty tuple if there are no opening hours for the given day.- Return type:
tuple[tuple[
datetime.datetime,datetime.datetime], …]
- is_open(datetime)[source]¶
Check if the business is open at the specified datetime.
Added in version 22.5.
- Parameters:
datetime (
datetime.datetime) – The datetime to check. If the object is timezone-naive, it is assumed to be in the timezone specified bytime_zone_name.- Returns:
True if the business is open at the specified time, False otherwise.
- Return type:
bool