Metadata-Version: 2.4
Name: yrwatertemperatures
Version: 0.2.0
Summary: A Python client to fetch water temperatures in Norway from YR.no.
Home-page: https://github.com/jornpe/yr-norwegian-water-temperatures
Author: Jørn Pettersen
Author-email: joern.pettersen@gmail.com
Project-URL: Bug Tracker, https://github.com/jornpe/yr-norwegian-water-temperatures/issues
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Typing :: Typed
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: aiohttp>=3.8.0
Dynamic: author
Dynamic: author-email
Dynamic: classifier
Dynamic: description
Dynamic: description-content-type
Dynamic: home-page
Dynamic: license-file
Dynamic: project-url
Dynamic: requires-dist
Dynamic: requires-python
Dynamic: summary

# 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:

```python
"""Example script to fetch and display water temperatures using the yrwatertemperatures package."""
import asyncio
from aiohttp import ClientSession, ClientError
from yrwatertemperatures import WaterTemperatures

API_KEY = "your_api_key_here"  # Replace with your actual API key

async def main() -> None:
    """Main function to fetch and display water temperatures."""
    async with ClientSession() as session:
        try:
            client = WaterTemperatures(API_KEY, session)
            temperatures = await client.async_get_all_water_temperatures()

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

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

loop = asyncio.new_event_loop()
loop.run_until_complete(main())
loop.close()
```

## 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).
