Skip to main content

Python API For Flick Electric in New Zealand

Project description

Build Status PyPI version

PyFlick

A quick and dirty Python API for Flick Electric.

Usage

from pyflick import FlickAPI
from pyflick.authentication import SimpleFlickAuth
from aiohttp import ClientSession

def async get_flick_pricing():
    async with ClientSession() as session:
        auth = SimpleFlickAuth("USERNAME", "PASSWORD", session)

        api = FlickAPI(auth)

        return await api.getPricing()

The SimpleFlickAuth client can also accept custom client ID and secret (this can be found by sniffing the client).

API will return a FlickPrice object for accessing the price information.

You can also get the raw data via FlickPrice.raw.

This will return a price object that looks a little like this:

{
  "kind": "mobile_provider_price",
  "customer_state": "active",
  "needle": {
    "price": "11.163",
    "status": "urn:flick:market:price:no_contract",
    "unit_code": "cents",
    "per": "kwh",
    "start_at": "2020-04-19T02:30:00Z",
    "end_at": "2020-04-19T02:59:59Z",
    "now": "2020-04-19T02:34:38.410Z",
    "type": "rated",
    "charge_methods": [
      "kwh"
    ],
    "components": [
      {
        "kind": "component",
        "charge_method": "kwh",
        "charge_setter": "retailer",
        "value": "4.26",
        "quantity": "1.0",
        "unit_code": "cents",
        "per": "kwh",
        "flow_direction": "import",
        "metadata": {
          "content_code": "UN",
          "channel_number": 1,
          "meter_serial_number": "RD1111111",
          "hours_of_availability": 24
        },
        "_links": {}
      },
      ...
    ]
  }
}

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

PyFlick-0.0.2.tar.gz (3.7 kB view hashes)

Uploaded Source

Built Distribution

PyFlick-0.0.2-py3-none-any.whl (5.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page