Skip to main content

Client for NIWA's APIs

Project description

Python API Client for NIWA's APIs

This Python package provides a convenient way to interact with NIWA's APIs. It includes functionality to fetch tide data, generate tide charts, and handle various data formats.

Disclaimer: This is not an official NIWA package. I have nothing to do with NIWA other than enjoying using their open APIs.

Installation

You can install the package using pip:

pip install niwa-api-client

Usage

Tide Data

To fetch tide data, you can use the TideAPIClient class. Here's an example of how to use it:

from niwa_api import TideAPIClient

client = TideAPIClient(api_key='YOUR_API_KEY')
data = client.get_data(lat=lat, long=long)
print(data)

CLI

The package also includes a command-line interface (CLI) for interacting with the APIs. You can use the niwa-tides command to fetch tide data or generate tide charts.

Fetch Tide Data

To fetch tide data, use the fetch-tide-data command:

niwa-tides --lat -36 --long 174 

To fetch the tide chart as a PNG image, use the format and output options:

niwa-tides --lat -36 --long 174 --format png --output tide.png

Using an API Key in the cli

You can either pass the api key as an argument:

niwa-tides --lat -36 --long 174 --api-key YOUR_API_KEY

Or set the NIWA_API_KEY environment variable:

export NIWA_API_KEY=YOUR_API_KEY
niwa-tides --lat -36 --long 174 

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

niwa_api_client-0.1.4.tar.gz (3.7 kB view details)

Uploaded Source

Built Distribution

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

niwa_api_client-0.1.4-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file niwa_api_client-0.1.4.tar.gz.

File metadata

  • Download URL: niwa_api_client-0.1.4.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.4.20

File hashes

Hashes for niwa_api_client-0.1.4.tar.gz
Algorithm Hash digest
SHA256 3f033949ed8b9d21e0d55a8ce181a0f5e21ca4c0aa689ba39711ef50dc22eea4
MD5 1d59dce97bce5f1bad4461edfe8457f8
BLAKE2b-256 9a9a6bcbbf6d57f5b06d1091d1ccc9508d889e4a81d4dc3dfca66598c2489797

See more details on using hashes here.

File details

Details for the file niwa_api_client-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for niwa_api_client-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 d6f2dae3f7fe5e0b5ff731eb49773599505cedc1dc6186bcd1894d54df352996
MD5 f5f7b85fbf8c3ea343a797b00b6a9ad6
BLAKE2b-256 cb304e52526c28cfc39667b59bcf9c87926bccc8748353bad565185918343143

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