Skip to main content

A Python client to fetch water temperatures in Norway from YR.no.

Project description

Norway Water Temperature API Client

A Python package to fetch water temperature data from various locations in Norway.

Installation

pip install yrwatertemperatures

API key

To use this package, you need an API key from yr.no, see https://hjelp.yr.no/hc/no/articles/5949243432850-API-for-badetemperaturer for more info.

Usage

First, you'll need to get an API key from the provider of the water temperature data.

Then, you can use the package like this:

from yrwatertemperatures import WaterTemperatures

# Replace 'YOUR_API_KEY' with your actual API key
api_key = 'YOUR_API_KEY'
client = WaterTemperatures(api_key)

try:
    # Fetch the water temperature data
    temperatures = client.get_all_water_temperatures()

    # Print the location and temperature
    for temp in temperatures:
        print(f"Location: {temp.name}, Temperature: {temp.temperature}°C")

except Exception as e:
    print(f"An error occurred: {e}")

Data Structure

The get_temperatures method returns a list of LocationData objects. Each object has the following attributes:

name (str): The name of the location.

location_id (str): A unique identifier for the location.

latitude (float): The latitude of the location.

longitude (float): The longitude of the location.

elevation (int): The elevation of the location in meters.

county (str): The county where the location is.

municipality (str): The municipality where the location is.

temperature (float): The water temperature in Celsius.

time (datetime): The timestamp of the reading.

source (str): The source of the data (not always present).

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

yrwatertemperatures-0.1.2.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

yrwatertemperatures-0.1.2-py3-none-any.whl (4.2 kB view details)

Uploaded Python 3

File details

Details for the file yrwatertemperatures-0.1.2.tar.gz.

File metadata

  • Download URL: yrwatertemperatures-0.1.2.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.6

File hashes

Hashes for yrwatertemperatures-0.1.2.tar.gz
Algorithm Hash digest
SHA256 5e5d2376c967a4fe660753afb2b379656efbd1e153d3f12d0afa57875f31d549
MD5 c0f28ac947548ea29b82d7b3833a2dc4
BLAKE2b-256 e7c1f1d797510be3308eeded9447dbc8b6e1bdaab66fd2d86338b7150a1ba07b

See more details on using hashes here.

File details

Details for the file yrwatertemperatures-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for yrwatertemperatures-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 260cf6704badd25eb396f3ffb6addc64ce17ca2b70df65fdc04d59688f8a527d
MD5 674d81e09f68f2b46491356a5e8d0119
BLAKE2b-256 769d1be2c8eb53e79388ddda345a078f2ee875ebec089d7f64d56cce8d8d0a31

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