File: instancevar.py

package info (click to toggle)
sphinx-toolbox 3.9.0-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,924 kB
  • sloc: python: 11,636; sh: 26; javascript: 25; makefile: 16
file content (25 lines) | stat: -rw-r--r-- 727 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# stdlib
from typing import Union

# 3rd party
from apeye.slumber_url import SlumberURL
from domdf_python_tools.secrets import Secret


class OctoAPI:
	"""
	The primary interface to the Octopus Energy API.

	:param api_key: API key to access the Octopus Energy API.

	If you are an Octopus Energy customer, you can generate an API key from your
	`online dashboard <https://octopus.energy/dashboard/developer/>`_.
	"""

	def __init__(self, api_key: str) -> None:

		#: The API key to access the Octopus Energy API.
		self.API_KEY: Union[Secret, str, float] = Secret(api_key)

		#: The base URL of the Octopus Energy API.
		self.API_BASE: "SlumberURL" = SlumberURL("https://api.octopus.energy/v1", auth=(self.API_KEY.value, ''))