abstract_api.timezone package#

Submodules#

Module contents#

class abstract_api.timezone.CurrentTimezoneResponse(response: Response)[source]#

Bases: JSONResponse

Current timezone service response.

property datetime: str | None#

The current date and time of the requested_location.

property gmt_offset: int | None#

Timezone’s offset from Greenwich Mean Time (GMT).

Read more: https://greenwichmeantime.com/what-is-gmt

property is_dst: bool | None#

Whether the location is currently in Daylight Savings Time (DST).

Read more: https://wikipedia.org/wiki/Daylight_saving_time

property latitude: float | None#

Decimal of the longitude found for the requested_location.

property longitude: float | None#

Decimal of the longitude found for the requested_location.

property requested_location: str | None#

The location from the request.

property timezone_abbreviation: str | None#

Timezone’s abbreviation, also from IANA Time Zone Database.

property timezone_location: str | None#

Timezone’s location.

property timezone_name: str | None#

Timezone’s name from IANA Time Zone Database.

Read more: https://www.iana.org/time-zones

class abstract_api.timezone.Timezone(api_key: str | None = None)[source]#

Bases: BaseService

AbstractAPI timezone service.

Used to find, convert, and manage time and timezone data across the world.

Attributes:

_subdomain: Timezone service subdomain.

convert(base_location: str | list[float] | tuple[float, float], target_location: str | list[float] | tuple[float, float], base_datetime: str | None = None) TimezoneConversionResponse[source]#

Converts datetime of base location to target location’s datetime.

By default, it converts the current time, but the conversion can take place in either the past or future with a simple parameter.

Args:
base_location: The location you use as a base to convert the

datetime for. This parameter accepts the location as a string (e.g., Los Angeles, CA), a longitude and latitude (e.g., -31.4173391,-64.183319), or an IP address (e.g., 82.111.111.111).

target_location: The location you want to get the datetime for.

This parameter accepts the location as a string (e.g., Los Angeles, CA), a longitude and latitude (e.g., -31.4173391,-64.183319), or an IP address (e.g., 82.111.111.111).

base_datetime: The datetime you’re converting.

Returns:

TimezoneConversionResponse representing API call response.

current(location: str | list[float] | tuple[float, float]) CurrentTimezoneResponse[source]#

Finds the current time, date, and timezone of a given location.

Args:
location: The location to determine the current time and

timezone of. This parameter accepts the location as a string (e.g., Los Angeles, CA), a longitude and latitude (e.g., -31.4173391,-64.183319), or an IP address (e.g., 82.111.111.111).

Returns:

CurrentTimezoneResponse representing API call response.

class abstract_api.timezone.TimezoneConversionResponse(response: Response)[source]#

Bases: NestedEntitiesMixin, JSONResponse

Timezone conversion service response.

property base_location: Timezone#

The time and timezone details of base location from request.

property target_location: Timezone#

The time and timezone details of target location from request.