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.6.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.6-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: niwa_api_client-0.1.6.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.6.tar.gz
Algorithm Hash digest
SHA256 8e84dd69373b08e3b72bc285c085f57abd7613dff8b4778cab8d846e869dc6b1
MD5 30b9c08662e058f097822a41ca432cb2
BLAKE2b-256 21f2949a84faf445a79fc181765b4da011f0f89580ec19d41a3a87f4b5380b0d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for niwa_api_client-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 c826603067a5bba1313ba10bd3f399793a4a716b83f921dd248a6d77ac0c930d
MD5 bc5ec6f850c81a752f8add5dfd90df59
BLAKE2b-256 001a0ac29f7aa33d15845a45ccbc6a78f37c26ca72119a39b92d5a5b5c2b2610

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