Skip to main content

UNKNOWN

Project description

https://travis-ci.org/kenners/sundowner.svg?branch=master

Sundowner is a Python3 Flask application that provides an API to return JSON objects containing Javascript timestamps of civil dawn, civil dusk, sunrise, and sunset.

It also provides a simple web app that uses this API.

Sundowner uses PyEphem to calculate astronomical parameters.

Sunrise and sunset times are calculated according to the United States Naval Observatory specifications, whereby for dawn and dusk, atmospheric refraction is estimated by setting observer pressure to zero and the horizon to 34 arcminutes below the normal horizon.

Civil dawn and dusk are when the sun is 6º below the horizon.

Sundowner is licensed under the MIT License.

Dependencies

Sundowner has the following Python3 dependencies:

  • Flask 0.10

  • ephem 3.7

  • itsdangerous 0.24

  • Jinja2 2.7.2

  • MarkupSafe 0.23

  • Werkzeug 0.9.4

  • python-dateutil 2.2

URL endpoints

Sundowner exposes the following endpoint:

  • /api/sun

Parameters

  • <lat> and <lon> are simple decimals of latitude and longitude respectively, e.g. Rothera’s location is expressed as -67.57 and -68.13

  • <start> and <end> are start and end dates for the desired period, in ISO 8601 format (as produced by Javascript’s .toJSON() method)

  • <output_type> is an optional parameter for the resulting datetimes, defaulting to iso for ISO 8601 format. Alternatively, use js for Javascript timestamp, or dt for a human-readable datetime.

Output

The API returns a JSON object, as follows:

{
  "days": [
    {
      "date": "2014-05-23",
      "events": {
        "civil_dawn": "2014-05-23T12:58:31.819853+00:00",
        "civil_dusk": "2014-05-23T19:59:14.923174+00:00",
        "sunrise": "2014-05-23T14:31:56.000752+00:00",
        "sunset": "2014-05-23T18:25:53.468033+00:00"
      }
    }
  ],
  "latlon": {
    "lat": "-67.57",
    "lon": "-68.13"
  }
}

Acknowledgements

Sundowner uses the following components:

Full-text copies of the above licenses may be found at:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Sundowner-0.1.4.tar.gz (1.2 MB view details)

Uploaded Source

File details

Details for the file Sundowner-0.1.4.tar.gz.

File metadata

  • Download URL: Sundowner-0.1.4.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for Sundowner-0.1.4.tar.gz
Algorithm Hash digest
SHA256 9fba3cf0f2c96ff1d28c3c6d47b71baf7c50f6740b1af8ed086df8ec4be9d340
MD5 9e5e8c07d62fa10407174975dfd95a2d
BLAKE2b-256 d4d03ba1b177e1cc4816f1c0174a62828221d58f127945364496eb42c79b2273

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page