Darksky
Python API wrapper for the DarkSky (async&sync)
Install / Use
/learn @Detrous/DarkskyREADME
DarkSky
Dark Sky, the provider on which this repo relies, will no longer accept new signups. The API will continue to function through the end of 2021.
This library for the Dark Sky API provides access to detailed weather information from around the globe.
Installation
pip3 install darksky_weather
Get started
Before you start using this library, you need to get your API key here.
All classes are fully annotated, source code it's your best doc : )
from darksky.api import DarkSky, DarkSkyAsync
from darksky.types import languages, units, weather
API_KEY = '0123456789abcdef9876543210fedcba'
# Synchronous way
darksky = DarkSky(API_KEY)
latitude = 42.3601
longitude = -71.0589
forecast = darksky.get_forecast(
latitude, longitude,
extend=False, # default `False`
lang=languages.ENGLISH, # default `ENGLISH`
values_units=units.AUTO, # default `auto`
exclude=[weather.MINUTELY, weather.ALERTS], # default `[]`,
timezone='UTC' # default None - will be set by DarkSky API automatically
)
# Synchronous way Time Machine
from datetime import datetime as dt
darksky = DarkSky(API_KEY)
t = dt(2018, 5, 6, 12)
latitude = 42.3601
longitude = -71.0589
forecast = darksky.get_time_machine_forecast(
latitude, longitude,
extend=False, # default `False`
lang=languages.ENGLISH, # default `ENGLISH`
values_units=units.AUTO, # default `auto`
exclude=[weather.MINUTELY, weather.ALERTS], # default `[]`,
timezone='UTC', # default None - will be set by DarkSky API automatically
time=t
)
# Asynchronous way
# NOTE! On Mac os you will have problem with ssl checking https://github.com/aio-libs/aiohttp/issues/2822
# So you need to create your own session with disabled ssl verify and pass it into the get_forecast
# session = aiohttp.ClientSession(connector=aiohttp.TCPConnector(verify_ssl=False))
# darksky = DarkSkyAsync(API_KEY)
# forecast = await darksky.get_forecast(
# *arguments*,
# client_session=session
# )
darksky = DarkSkyAsync(API_KEY)
latitude = 42.3601
longitude = -71.0589
forecast = await darksky.get_forecast(
latitude, longitude,
extend=False, # default `False`
lang=languages.ENGLISH, # default `ENGLISH`
values_units=units.AUTO, # default `auto`
exclude=[weather.MINUTELY, weather.ALERTS], # default `[]`
timezone='UTC' # default None - will be set by DarkSky API automatically,
client_session=aiohttp.ClientSession() # default aiohttp.ClientSession()
)
# Final wrapper identical for both ways
forecast.latitude # 42.3601
forecast.longitude # -71.0589
forecast.timezone # timezone for coordinates. For exmaple: `America/New_York`
forecast.currently # CurrentlyForecast. Can be found at darksky/forecast.py
forecast.minutely # MinutelyForecast. Can be found at darksky/forecast.py
forecast.hourly # HourlyForecast. Can be found at darksky/forecast.py
forecast.daily # DailyForecast. Can be found at darksky/forecast.py
forecast.alerts # [Alert]. Can be found at darksky/forecast.py
Contact us.
If you have any issues or questions regarding the library, you are welcome to create an issue, or
You can write an Email to detrous@protonmail.com
License.
Library is released under the MIT License.
Related Skills
node-connect
339.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
claude-opus-4-5-migration
83.9kMigrate prompts and code from Claude Sonnet 4.0, Sonnet 4.5, or Opus 4.1 to Opus 4.5
frontend-design
83.9kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
model-usage
339.3kUse CodexBar CLI local cost usage to summarize per-model usage for Codex or Claude, including the current (most recent) model or a full model breakdown. Trigger when asked for model-level usage/cost data from codexbar, or when you need a scriptable per-model summary from codexbar cost JSON.
