Skip to main content

Heliacal PyPI

Python module to get sunrise, sunset, daytime, and twilight data for a location.

This is an API wrapper for sunrise-sunset.org.

To get started, install heliacal

pip install heliacal

Next, add heliacal and datetime to your project

from heliacal import Heliacal
import datetime

Heliacal requires datetime to run.

Create a heliacal object

Heliacal uses latitude and longitude to determine solar data for a location. You can use modules such as geopy to get the co-ordinates of a named location.

los_angeles = Heliacal(34.052235, -118.243683)

By default, Heliacal will set the date to today, to change that, use set_date().

los_angeles.set_date(datetime.datetime(2018, 12, 31)) # Get solar data for 2018-12-31

You now have a working Heliacal instance! You can get the following information:

los_angeles.sunrise # 2018-12-31 14:58:24
los_angeles.sunset # 2019-01-01 00:54:16
los_angeles.solar_noon # 2018-12-31 19:56:20
los_angeles.day_length # 35752 (seconds)
los_angeles.civil_twilight_begin # 2018-12-31 14:30:50
los_angeles.civil_twilight_end # 2019-01-01 01:21:49
los_angeles.nautical_twilight_begin # 2018-12-31 13:59:38
los_angeles.nautical_twilight_end # 2019-01-01 01:53:01
los_angeles.astronomical_twilight_begin # 2018-12-31 13:29:11
los_angeles.astronomical_twilight_end # 2019-01-01 02:23:28

# For debugging or other things, there are:
los_angeles.requesturl # https://api.sunrise-suns...
los_angeles.json # {'sunrise': '2018-12-31T14:58:...

Note: Heliacal returns UTC datetimes, it is the developer's job to turn them to the respective timezone.

Troubleshooting

If you receive an SSL: CERTIFICATE_VERIFY_FAILED error and you are using MacOS. Follow these steps in terminal:

cd /Applications/Python\ 3.7
./Install Certificates.command

Release files for Heliacal 2.0.1

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

Source distribution (sdist)

Source distribution for Heliacal 2.0.1
File Size Uploaded
Heliacal-2.0.1.tar.gz 2.0 kB Details

Release files / Heliacal-2.0.1.tar.gz

Download URL Heliacal-2.0.1.tar.gz
Size 2.0 kB
Tags Source
SHA-256 checksum
How to use checksums
45eac3344be5aedccacdf38203484461c972a0c9723e6cb5979e5d25cc4f7965
BLAKE2b-256 checksum
How to use checksums
732c85ce84be764716ad31f3e377a0af03d72575ef88ffe4edea2e3913cd5ca4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2

Release history Release notifications | RSS feed

This release

2.0.1 This release

1 release file

1.0.0

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