Skip to main content

OpenWeather Report

Get weather using OpenWeather API and save to a database.

Quickstart

To install, you can use pipx:

$ pipx install openweather_report

or use uv:

$ uv tool install openweather_report

If using pip I would suggest installing into a virtual environment. Note that libpq is required for psycopg2. Below is how to install using a Debian based distro like Ubuntu:

$ sudo apt install install libpq-dev libpq5

Then you can install openweather_report. Then to get help, do:

$ openweather_report --help
Usage: openweather_report [OPTIONS] {one_call}
                          LATITUDE LONGITUDE API_KEY

  Take user inputs and save to either file or database.

Options:
  --weather_date [%Y-%m-%d %H:%M]
                                  Put in the date to get the weather for a
                                  particular day.
  --save [json|postgresql|sqlite]
  --save_path TEXT
  --db_string TEXT                Connection string to save to database.
  --version                       Show the version and exit.
  --help                          Show this message and exit.

To save data to a json file:

$ openweather_report one_call 30.00 -30.00 your-api-key --save json --save_path
my_city.json

Setting up Database Structure

Currently PostgreSQL and Sqlite are supported. The table structure will need to be generated before attempting to save any data.

PostgreSQL

Below is the structure for raw_json_data:

create schema if not exists weather;

create table if not exists weather.raw_json_data (
(
     id bigserial not null
    ,entry_date timestamp with time zone not null
    ,api_call text not null
    ,raw_data jsonb null
    ,software_version null
    ,primary key (id)
);

SQLite

The structure is similar to PostgreSQL but does not have a schema:

create table if not exists raw_json_data
(
     id integer primary key
    ,entry_date text not null
    ,api_call text not null
    ,raw_data text null
    ,software_version text null
);

DuckDB

The structure is similar to PostgreSQL but does not have a schema:

create table is not exists raw_json_data
(
    id integer primary key
   ,entry_date timestamp with time zone not null
   ,api_call text not null
   ,raw_data jsonb null
   ,software_version null
   ,primaty key (id)
);

OpenWeather API

Go to https://openweathermap.org/api though this program currently only supports the One Call API. The program will eventually support other APIs.

Development

The recommended way is to use uv:

$ git clone git@github.com:cetyler/openweather_report.git
$ uv venv --python 3.13
Using Python 3.13
Creating virtualenv at: .venv
Activate with: source .venv/bin/activate
$ source .venv/bin/activate
$ uv sync --dev

Release files for openweather_report 0.3.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 openweather_report 0.3.1
File Size Uploaded
openweather_report-0.3.1.tar.gz 45.2 kB Details

Built distribution (wheel)

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

Total release size: 54.4 kB

Release files / openweather_report-0.3.1.tar.gz

Download URL openweather_report-0.3.1.tar.gz
Size 45.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e29661eb2fab2e6c961b1deab41bd0a2c2334ee3b7ec2bc9abab23942cd652ad
BLAKE2b-256 checksum
How to use checksums
81c74e2983f83ac3c169312692c3c2d33dab90f2480d49ab62ea472d106212b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.5.18

Release files / openweather_report-0.3.1-py3-none-any.whl

Download URL openweather_report-0.3.1-py3-none-any.whl
Size 9.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
87d4971858ed7973899a7cc4b3f3fb5a15769adafb66b974e33c3fab90e57423
BLAKE2b-256 checksum
How to use checksums
af6e77b6b403bd163e308cebb623d0ba86906145d879d0ec1a26ac1e35d584cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.5.18

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.1.5

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