weather API Python Client

Extract weather data with our weather API Python client. Get programmatic access to wind speed, weather conditions, humidity, forecasts, temperature, and more using simple Python code. Start free, no credit card required.

Trusted by industry leaders all over the world

Integrate our weather API

The Apify API client for Python is the official library that allows you to use weather API in Python, providing convenience functions and automatic retries on errors. Get started with simple pip installation and robust error handling built-in.

Python

Python

JavaScript

JavaScript

HTTP

HTTP

MCP

MCP

1from apify_client import ApifyClient
2
3# Initialize the ApifyClient with your Apify API token
4# Replace '<YOUR_API_TOKEN>' with your token.
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7# Prepare the Actor input
8run_input = {
9 "startUrls": [
10 { "url": "https://weather.com/weather/today/l/5aea1d50a6d6b9e99cf89ba79f463d67dcf21ea5061990aae1ffc1c7fa8911a9" },
11 { "url": "https://weather.com/weather/today/l/ada030b2de8db495da2d93d5a2ecf30de1ce8b54cb09725d19c803543685646d" },
12 ],
13 "locations": [
14 "Montgomery, Alabama",
15 "Juneau, Alaska",
16 ],
17 "locationIds": [
18 "e60256f3426acd3c1b3380921210fcffeab628a120c41d1de03b59a0f0dd32ad",
19 "bf217d537cc1c8074ec195ce07fb74de3c1593caa6033b7c3be4645ccc5b01de",
20 ],
21 "timeFrame": "today",
22 "units": "imperial",
23 "maxItems": 10,
24 "proxyConfiguration": { "useApifyProxy": True },
25 "extendOutputFunction": "($) => { return {} }",
26 "customMapFunction": "(object) => { return {...object} }",
27}
28
29# Run the Actor and wait for it to finish
30run = client.actor("epctex/weather-scraper").call(run_input=run_input)
31
32# Fetch and print Actor results from the run's dataset (if there are any)
33print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
34for item in client.dataset(run["defaultDatasetId"]).iterate_items():
35 print(item)
36
37# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

Get data with weather API Python client

Use our Python API client to extract weather data by providing locations, location IDs, or start URLs. The API returns structured data, including temperature, humidity, wind direction, wind speed, forecasts, and location details with city, state, country, and zip code in JSON format.

Input

{
"units": "metric",
"maxItems": 10,
"locations": [
"Montgomery, Alabama",
"Juneau, Alaska"
],
"startUrls": [
{
"url": "<https://weather.com/weather/today/l/5aea1d50a6d6b9e99cf89ba79f463d67dcf21ea5061990aae1ffc1c7fa8911a9>"
},
{
"url": "<https://weather.com/weather/today/l/ada030b2de8db495da2d93d5a2ecf30de1ce8b54cb09725d19c803543685646d>"
}
],
"timeFrame": "ten_day",
"locationIds": [
"e60256f3426acd3c1b3380921210fcffeab628a120c41d1de03b59a0f0dd32ad",
"bf217d537cc1c8074ec195ce07fb74de3c1593caa6033b7c3be4645ccc5b01de"
],
"customMapFunction": "(object) => {return {...object, }}",
"proxyConfiguration": {
"useApifyProxy": true
},
"extendOutputFunction": "($) => {}"
}

Output

{
"city": "Třeboň",
"time": "2020-08-15T07:00:00+0200",
"state": "South Bohemia",
"country": "Czech Republic",
"zipCode": "379 01",
"forecast": "Thunderstorms/Scattered Thunderstorms",
"humidity": "79/88",
"windSpeed": "9/6",
"temperature": "24/16",
"windDirection": "W/WNW"
}

How to use weather API

Sign up for Apify account01

Creating an account is quick and free — no credit card required. Your account gives you access to more than 5,000 scrapers and APIs.

Get started for free
Install Apify Python client02

Install the Apify Python client using pip: pip install apify-client. This package provides a simple interface to interact with weather API from your Python applications.

Get your Apify API token03

Go to settings in the Apify console and navigate to the “API & Integrations” tab. There, create a new token and save it for later.

Integrate weather API04

Navigate to the weather API page and click on the API dropdown menu in the top right corner. In the dropdown menu, you can see API clients, API endpoints, and more. Use the provided Python code examples to integrate weather API into your Python application.

Open weather Python API
Get your weather data via API05

The weather API returns structured JSON data that works perfectly with pandas, NumPy, and other Python data analysis libraries.

Why use Apify?

Never get blocked

Every plan (free included) comes with Apify Proxy, which is great for avoiding blocking and giving you access to geo-specific content.

Customers love us

We truly care about the satisfaction of our users and thanks to that we're one of the best-rated data extraction platforms on both G2 and Capterra.

Monitor your runs

With our latest monitoring features, you always have immediate access to valuable insights on the status of your web scraping tasks.

Export to various formats

Your datasets can be exported to any format that suits your data workflow, including Excel, CSV, JSON, XML, HTML table, JSONL, and RSS.

Integrate Apify to your workflow

You can integrate your Apify runs with platforms such as Zapier, Make, Keboola, Google Drive, or GitHub. Connect with practically any cloud service or web app.

Large developer community

Apify is built by developers, so you'll be in good hands if you have any technical questions. Our Discord server is always here to help!

Frequently asked questions

No, there is no official Weather.com Python API client available for public use. This Weather Scraper provides an alternative Python API client solution by extracting weather data directly from Weather.com, giving you access to the same comprehensive weather information through a reliable Python scraping API client.

Yes, you can try the Weather Scraper Python API client for free. Apify offers a free tier that allows you to test the Python API client before committing to the $10.00/month subscription plus usage costs. You can start with the free trial to evaluate the data quality and features using the Python API client.

You can extract comprehensive weather data using a Python API client including current temperature, forecasts, humidity levels, wind direction and speed, weather conditions, and location details (city, state, country, zip code). The Python API client supports multiple time frames from current conditions to 10-day forecasts, with data available in both metric and imperial units.

Getting started with our weather Python API is easy — simply create a free Apify account, get your API token, and start using the weather API in Python, JavaScript, CLI, cURL, OpenAPI, or MCP.

Get started with weather API Python client today

Get your first weather data in Python in less than 5 minutes. No credit card required. No commitment. Cancel anytime.