Skip to main content

No project description provided

Project description

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

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

openweather_report-0.2.4.tar.gz (33.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

openweather_report-0.2.4-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file openweather_report-0.2.4.tar.gz.

File metadata

  • Download URL: openweather_report-0.2.4.tar.gz
  • Upload date:
  • Size: 33.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.5.14

File hashes

Hashes for openweather_report-0.2.4.tar.gz
Algorithm Hash digest
SHA256 be9c7796562b7dfc74138336a99d9526b52ccf83631b59bd78e4ac8f2afb27bf
MD5 9025dfc3ad64a901dd439083527da291
BLAKE2b-256 a0166e4b3c957782edf12f3d7134ab95334e3506989afd2207cd145bc8239a7c

See more details on using hashes here.

File details

Details for the file openweather_report-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for openweather_report-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 dfa226a3f4cb7cb3e1dc334d722da755ce094d8128ac62c24d8763eead393d65
MD5 0917e1fb185cee7a60a16078f68cce33
BLAKE2b-256 39ea1d8f48a536723d3a519595744fbef93b6d16bf25eff51784d92b4e2fc7ad

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