Skip to main content

Python Wrapper for Visual Crossing Weather API

This Python Wrapper retrives data from the Visual Crossing API. Visual Crossing has an extensive Weather API for both historical and forecast weather data, and they have a Free Tier API Key which enables up to 1000 calls per day.

In order to get started you must create an Account with Visual Crossing and then create an API Key. You do this by accessing this website and clicking on the Free plan. Then follow the instructions to create and account and store your key in a safe place.

Usage

Install the module by using this command in a terminal: pip install pyVisualCrossing

And then see test_module.py for a usage example.

Parameters

# Initialise the module
vcapi = VisualCrossing(
    api_key,
    latitude,
    longitude,
    days=7,
    language="da"
)
Parameter Required Default Description
api_key Yes None This is the API Key you signed up for from Visual Crossing. See above for instructions
latitude Yes None Latitude for the location position
longitude Yes None Longitude for the location position
days No 14 Numbers of days to retrieve forecast for. 14 days means today plus the next 14 days. On the Free plan, this is the maximum number of days
language No en The language in which text strings should be returned. Se below for list of valid languages.
session No None An aiohttp.ClientSession to reuse for the async function. If not supplied, a session is created and closed automatically.

For an in-depth description of the Visual Crossing API, go here

Fetching Data

Once initialised, call either the synchronous or the async method to retrieve data. Both return a single ForecastData object (or None if the request failed), holding the current conditions plus a daily and an hourly forecast list.

# Synchronous
data = vcapi.fetch_data()

# Async
data = await vcapi.async_fetch_data()

print(data.temperature)
for day in data.forecast_daily:
    print(day.datetime, day.temperature, day.condition)

for hour in data.forecast_hourly:
    print(hour.datetime, hour.temperature, hour.condition)

Exceptions

If the API request fails, one of these exceptions (all importable from pyVisualCrossing) is raised:

Exception Description
VisualCrossingBadRequest The request was invalid (invalid dates, bad location parameter, etc.)
VisualCrossingUnauthorized The API key is incorrect, or the account is inactive or disabled
VisualCrossingTooManyRequests Too many daily requests for the current plan
VisualCrossingInternalServerError Visual Crossing's servers encountered an unexpected error
VisualCrossingException Generic base exception for failing to access the API

Data

Current Conditions (ForecastData)

Property Description
datetime Valid time (UTC)
temperature Air temperature
apparent_temperature Feels-like temperature
dew_point Dew point
condition Weather condition text
icon Weather condition icon id
cloud_cover Cloud coverage (%)
humidity Humidity (%)
precipitation Precipitation
precipitation_probability Probability of precipitation (%)
pressure Sea level pressure
solarradiation Solar radiation (W/m2)
visibility Visibility
uv_index UV index
wind_bearing Wind bearing (degrees)
wind_speed Wind speed
wind_gust_speed Wind gust speed
location_name Name of the location
description Weather description
snow Snowfall
snow_depth Snow depth
precipitation_type Type(s) of precipitation, if any (e.g. rain, snow)
solarenergy Solar energy (MJ/m2)
sunrise Sunrise time
sunset Sunset time
moon_phase Moon phase, as a fraction between 0 and 1
update_time Timestamp of when the data was fetched
forecast_daily List of ForecastDailyData
forecast_hourly List of ForecastHourlyData

Daily Forecast (ForecastDailyData)

Property Description
datetime Valid date (UTC)
temperature Max air temperature for the day
temp_low Min air temperature for the day
apparent_temperature Feels-like temperature
condition Weather condition text
icon Weather condition icon id
cloud_cover Cloud coverage (%)
dew_point Dew point
humidity Humidity (%)
precipitation Precipitation
precipitation_probability Probability of precipitation (%)
pressure Sea level pressure
uv_index UV index
wind_bearing Wind bearing (degrees)
wind_speed Wind speed
wind_gust Wind gust speed
snow Snowfall
snow_depth Snow depth
precipitation_type Type(s) of precipitation, if any (e.g. rain, snow)
precipitation_cover Percentage of the day with precipitation (%)
solarradiation Solar radiation (W/m2)
solarenergy Solar energy (MJ/m2)
severe_risk Risk score of severe weather
sunrise Sunrise time
sunset Sunset time
moon_phase Moon phase, as a fraction between 0 and 1

Hourly Forecast (ForecastHourlyData)

Only hours later than the current time are included.

Property Description
datetime Valid date and time (UTC)
temperature Air temperature
apparent_temperature Feels-like temperature
condition Weather condition text
icon Weather condition icon id
cloud_cover Cloud coverage (%)
dew_point Dew point
humidity Humidity (%)
precipitation Precipitation
precipitation_probability Probability of precipitation (%)
pressure Sea level pressure
uv_index UV index
wind_bearing Wind bearing (degrees)
wind_speed Wind speed
wind_gust_speed Wind gust speed
snow Snowfall
snow_depth Snow depth
precipitation_type Type(s) of precipitation, if any (e.g. rain, snow)
solarradiation Solar radiation (W/m2)
solarenergy Solar energy (MJ/m2)
severe_risk Risk score of severe weather
visibility Visibility

Languages

Available languages include: ar (Arabic), bg (Bulgiarian), cs (Czech), da (Danish), de (German), el (Greek Modern), en (English), es (Spanish), fa (Farsi), fi (Finnish), fr (French), he (Hebrew), hu, (Hungarian), it (Italian), ja (Japanese), ko (Korean), nl (Dutch), pl (Polish), pt (Portuguese), sr (Serbian), sv (Swedish), tr (Turkish), uk (Ukranian), vi (Vietnamese) and zh (Chinese).

Metrics

All records are returned using the Metric unit system. There is no conversion possible at the moment.

Weather variable Measurement Unit
Datetime UTC datetime
Temperature, Heat Index & Wind Chill Degrees Celcius
Precipitation Millimeters
snow Centimeters
Wind & Wind Gust Kilometers Per Hour
Visibility Kilometers
Pressure Millibars (Hectopascals)
Solar Radiation W/m2
Solar Energy MJ/m2

Icons

We use the Iconset icons2, which gives a more detailed description of the conditions.

Icon id Weather Conditions
snow Amount of snow is greater than zero
snow-showers-day Periods of snow during the day
snow-showers-night Periods of snow during the night
thunder-rain Thunderstorms throughout the day or night
thunder-showers-day Possible thunderstorms throughout the day
thunder-showers-night Possible thunderstorms throughout the night
rain Amount of rainfall is greater than zero
showers-day Rain showers during the day
showers-night Rain showers during the night
fog Visibility is low (lower than one kilometer or mile)
wind Wind speed is high (greater than 30 kph or mph)
cloudy Cloud cover is greater than 90% cover
partly-cloudy-day Cloud cover is greater than 20% cover during day time.
partly-cloudy-night Cloud cover is greater than 20% cover during night time.
clear-day Cloud cover is less than 20% cover during day time
clear-night Cloud cover is less than 20% cover during night time

Metadata

Release files for pyVisualCrossing 1.1.0

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

Source distribution (sdist)

Source distribution for pyVisualCrossing 1.1.0
File Size Uploaded
pyvisualcrossing-1.1.0.tar.gz 13.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyVisualCrossing 1.1.0
File Interpreter ABI Platform
pyvisualcrossing-1.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 23.9 kB

Release files / pyvisualcrossing-1.1.0.tar.gz

Download URL pyvisualcrossing-1.1.0.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
89abc8e40c826a295c185f91facb1f6b7bab605990268cb0a2132c5bf3522ffe
BLAKE2b-256 checksum
How to use checksums
e5a403d60d1f1092689e135ffca53eb542d9a14eecdb8698412af2c2276acfd0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / pyvisualcrossing-1.1.0-py3-none-any.whl

Download URL pyvisualcrossing-1.1.0-py3-none-any.whl
Size 10.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b68d6f0318d81b0f6a02bbc823ccbd7779c87e8dd0f4b94c1dd9bcfcfd031872
BLAKE2b-256 checksum
How to use checksums
3f40bf07ba13c721e053dcd038f3264c2ab3a84eb7b6a3de4da84f20e1db67be
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.1.0 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.1.16

2 release files

0.1.15

2 release files

0.1.14

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.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