abstract_api.timezone package#
Submodules#
Module contents#
- class abstract_api.timezone.CurrentTimezoneResponse(response: Response)[source]#
Bases:
JSONResponseCurrent 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).
- 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:
BaseServiceAbstractAPI 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,JSONResponseTimezone conversion service response.