octo_api.products
Classes to model products and tariffs.
Classes:
|
Represents an Octopus Energy product. |
|
Represents an Octopus Energy product. |
|
Represents an Octopus Energy product, with detailed tariff information. |
|
Represents a tariff for a product. |
|
Represents the unit rate of a tariff at a particular period in time. |
Mapping of GSP regions to a mapping of payment methods to |
|
|
Mapping of GSP regions to a mapping of payment methods to a mapping of fuel types to |
-
class
BaseProduct
(available_from, available_to, brand, code, description, display_name, full_name, is_business, is_green, is_prepay, is_restricted, is_tracker, is_variable, links, term)[source] Bases:
object
Represents an Octopus Energy product.
- Parameters
available_from (
Union
[str
,datetime
,None
]) – The date from which the product is available.available_to (
Union
[str
,datetime
,None
]) – The date until which the product is available.brand (
str
) – The brand under which the product is sold.code (
str
) – The tariff code.description (
str
) – A description of the product.display_name (
str
) – The display name of the product.full_name (
str
) – The name of the product.is_business (
bool
) – Whether the product is for businesses.is_green (
bool
) – Whether the product is green.is_prepay (
bool
) – Whether the product is prepay.is_restricted (
bool
) – Whether the product is restricted.is_tracker (
bool
) – Whether the product tracks the wholesale electricity rate.is_variable (
bool
) – Whether the product has a variable tariff.links (
Iterable
[MutableMapping
[str
,Any
]]) – Links associated with this product.term (
Optional
[int
]) – The number of months that a product lasts for if it is fixed length.
Attributes:
The date from which the product is available.
The date until which the product is available.
The brand under which the product is sold.
The code of the product.
A description of the product.
The display name of the product.
The name of the product.
Whether the product is for businesses.
Whether the product is green.
Whether the product is prepay.
Whether the product is restricted.
Whether the product tracks the wholesale electricity rate.
Whether the product has a variable tariff.
Links associated with this product.
The number of months that a product lasts for if it is fixed length.
Methods:
from_dict
(d)Construct an instance of
BaseProduct
from a dictionary.to_dict
([convert_values])Returns a dictionary containing the contents of the
BaseProduct
object.-
classmethod
from_dict
(d) Construct an instance of
BaseProduct
from a dictionary.
-
links
Type:
List
[MutableMapping
[str
,Any
]]Links associated with this product.
-
to_dict
(convert_values=False) Returns a dictionary containing the contents of the
BaseProduct
object.
-
class
Product
(available_from, available_to, brand, code, description, display_name, full_name, is_business, is_green, is_prepay, is_restricted, is_tracker, is_variable, links, term, direction)[source] Bases:
octo_api.products.BaseProduct
Represents an Octopus Energy product.
- Parameters
available_from (
Union
[str
,datetime
,None
]) – The date from which the product is available.available_to (
Union
[str
,datetime
,None
]) – The date until which the product is available.brand (
str
) – The brand under which the product is sold.code (
str
) – The tariff code.description (
str
) – A description of the product.display_name (
str
) – The display name of the product.full_name (
str
) – The name of the product.is_business (
bool
) – Whether the product is for businesses.is_green (
bool
) – Whether the product is green.is_prepay (
bool
) – Whether the product is prepay.is_restricted (
bool
) – Whether the product is restricted.is_tracker (
bool
) – Whether the product tracks the wholesale electricity rate.is_variable (
bool
) – Whether the product has a variable tariff.links (
Iterable
[MutableMapping
[str
,Any
]]) – Links associated with this product.term (
Optional
[int
]) – The number of months that a product lasts for if it is fixed length.direction (
str
) – The direction of the product (supply to the customer or supply to the grid).
Attributes:
The direction of the product (supply to the customer or supply to the grid).
-
class
DetailedProduct
(available_from, available_to, brand, code, description, display_name, full_name, is_business, is_green, is_prepay, is_restricted, is_tracker, is_variable, links, term, tariffs_active_at, single_register_electricity_tariffs, dual_register_electricity_tariffs, single_register_gas_tariffs, sample_quotes, sample_consumption)[source] Bases:
octo_api.products.BaseProduct
Represents an Octopus Energy product, with detailed tariff information.
Each
*_tariffs
object will have up to 14 keys; one for each GSP. For each GSP the applicable tariffs are listed under their associated payment method, e.g. direct_debit_monthly.The
standard_unit_rate_*
values are listed in p/kWh (pence per kilowatt hour).The
standing_charge_*
values are listed in p/day (pence per day).The
annual_cost_*
values are listed in p (pence).
- Parameters
available_from (
Union
[str
,datetime
,None
]) – The date from which the product is available.available_to (
Union
[str
,datetime
,None
]) – The date until which the product is available.brand (
str
) – The brand under which the product is sold.code (
str
) – The tariff code.description (
str
) – A description of the product.display_name (
str
) – The display name of the product.full_name (
str
) – The name of the product.is_business (
bool
) – Whether the product is for businesses.is_green (
bool
) – Whether the product is green.is_prepay (
bool
) – Whether the product is prepay.is_restricted (
bool
) – Whether the product is restricted.is_tracker (
bool
) – Whether the product tracks the wholesale electricity rate.is_variable (
bool
) – Whether the product has a variable tariff.links (
Iterable
[MutableMapping
[str
,Any
]]) – Links associated with this product.term (
Optional
[int
]) – The number of months that a product lasts for if it is fixed length.single_register_electricity_tariffs (
Dict
[str
,Dict
[str
,Dict
[str
,Any
]]]) – Mapping of GSPs to applicable tariffs for each payment method, e.g. direct_debit_monthly.dual_register_electricity_tariffs (
Dict
[str
,Dict
[str
,Dict
[str
,Any
]]]) – Mapping of GSPs to applicable tariffs for each payment method, e.g. direct_debit_monthly.single_register_gas_tariffs (
Dict
[str
,Dict
[str
,Dict
[str
,Any
]]]) – Mapping of GSPs to applicable tariffs for each payment method, e.g. direct_debit_monthly.sample_consumption (
Dict
)
Attributes:
Mapping of GSPs to applicable tariffs for each payment method, e.g.
Mapping of GSPs to applicable tariffs for each payment method, e.g.
Mapping of GSPs to applicable tariffs for each payment method, e.g.
Methods:
from_dict
(d)Construct an instance of
DetailedProduct
from a dictionary.to_dict
([convert_values])Returns a dictionary containing the contents of the
DetailedProduct
object.-
dual_register_electricity_tariffs
Type:
Dict
Mapping of GSPs to applicable tariffs for each payment method, e.g. direct_debit_monthly.
-
classmethod
from_dict
(d) Construct an instance of
DetailedProduct
from a dictionary.
-
single_register_electricity_tariffs
Type:
Dict
Mapping of GSPs to applicable tariffs for each payment method, e.g. direct_debit_monthly.
-
single_register_gas_tariffs
Type:
Dict
Mapping of GSPs to applicable tariffs for each payment method, e.g. direct_debit_monthly.
-
to_dict
(convert_values=False) Returns a dictionary containing the contents of the
DetailedProduct
object.
-
class
RateInfo
(value_exc_vat, value_inc_vat, valid_from, valid_to)[source] Bases:
object
Represents the unit rate of a tariff at a particular period in time.
- Parameters
value_exc_vat (
float
) – In p/kWh (pence per kilowatt hour).value_inc_vat (
float
) – In p/kWh (pence per kilowatt hour).valid_from (
Union
[str
,datetime
,None
]) – The date and time from which this rate is in effect.valid_to (
Union
[str
,datetime
,None
]) – The date and time until which this rate is in effect, orNone
if this rate continues in perpetuity.
Methods:
from_dict
(d)Construct an instance of
RateInfo
from a dictionary.to_dict
([convert_values])Returns a dictionary containing the contents of the
RateInfo
object.Attributes:
The date and time from which this rate is in effect.
The date and time until which this rate is in effect, or
None
if this rate continues in perpetuity.In p/kWh (pence per kilowatt hour).
In p/kWh (pence per kilowatt hour).
-
to_dict
(convert_values=False) Returns a dictionary containing the contents of the
RateInfo
object.
-
class
Tariff
(code, standing_charge_exc_vat, standing_charge_inc_vat, online_discount_exc_vat, online_discount_inc_vat, dual_fuel_discount_exc_vat, dual_fuel_discount_inc_vat, exit_fees_exc_vat, exit_fees_inc_vat, links, standard_unit_rate_exc_vat=None, standard_unit_rate_inc_vat=None, day_unit_rate_exc_vat=None, day_unit_rate_inc_vat=None, night_unit_rate_exc_vat=None, night_unit_rate_inc_vat=None)[source] Bases:
object
Represents a tariff for a product.
- Parameters
code (
str
) – The tariff code.standing_charge_exc_vat (
float
) – In p/day (pence per day).standing_charge_inc_vat (
float
) – In p/day (pence per day).online_discount_exc_vat (
int
)online_discount_inc_vat (
int
)dual_fuel_discount_exc_vat (
int
)dual_fuel_discount_inc_vat (
int
)exit_fees_exc_vat (
int
)exit_fees_inc_vat (
int
)links (
List
[Dict
[str
,Any
]]) – Links associated with this product.standard_unit_rate_exc_vat (
Optional
[float
]) – In p/kWh (pence per kilowatt hour). DefaultNone
.standard_unit_rate_inc_vat (
Optional
[float
]) – In p/kWh (pence per kilowatt hour). DefaultNone
.day_unit_rate_exc_vat (
Optional
[float
]) – In p/kWh (pence per kilowatt hour). DefaultNone
.day_unit_rate_inc_vat (
Optional
[float
]) – In p/kWh (pence per kilowatt hour). DefaultNone
.night_unit_rate_exc_vat (
Optional
[float
]) – In p/kWh (pence per kilowatt hour). DefaultNone
.night_unit_rate_inc_vat (
Optional
[float
]) – In p/kWh (pence per kilowatt hour). DefaultNone
.
Methods:
from_dict
(d)Construct an instance of
Tariff
from a dictionary.to_dict
([convert_values])Returns a dictionary containing the contents of the
Tariff
object.