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_client 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 API_KEY environment variable:

export 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.2.tar.gz (3.6 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.2-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for niwa_api_client-0.1.2.tar.gz
Algorithm Hash digest
SHA256 b46e715d17113cf2eb6a18eb1dd5b5df796b3f791e6bf8602d5a43ad160a4878
MD5 459fb2b962acd7351a478391d35c7133
BLAKE2b-256 6c9c9eeabd1dd3bb733ad215a0aeee7ffd4f818832e342caaaad5aee35ded058

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for niwa_api_client-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 600f113087d0215d9d39b7feda9434f15d156a2ce84013e100f911d4e26dcab7
MD5 72065cf0e4d0d64b53ea0e702292431a
BLAKE2b-256 5c7a0fe63d3b188e30d41f6b306c46c73863e61081e1a31ab5fc9803ca517de3

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