Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit e23a8a6

Browse files
author
Michael Arthur
committed
fix values not being returned
1 parent 924fd07 commit e23a8a6

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

.idea/markdown.xml

+9
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/electrickiwi_api/api.py

+15-15
Original file line numberDiff line numberDiff line change
@@ -73,70 +73,70 @@ async def set_active_session(self):
7373
async def get_active_session(self):
7474
session = await self.auth.request("get", ElectricKiwiEndpoint.session)
7575
check_status(session.status)
76-
Session.from_dict(await session.json())
76+
return Session.from_dict(await session.json())
7777

7878
async def get_customer(self):
7979
customer = await self.auth.request("get",
8080
ElectricKiwiEndpoint.customer.format(customerNumber=self.customer_number))
8181
check_status(customer.status)
82-
Customer.from_dict(await customer.json())
82+
return Customer.from_dict(await customer.json())
8383

8484
async def get_connection_details(self):
8585
connection_details = await self.auth.request("get", ElectricKiwiEndpoint.customerConnectionDetails.format(
8686
customerNumber=self.customer_number,
8787
connectionId=self.connection_id))
8888
check_status(connection_details.status)
89-
CustomerConnection.from_dict(await connection_details.json())
89+
return CustomerConnection.from_dict(await connection_details.json())
9090

9191
async def get_billing_address(self):
9292
billing_address = await self.auth.request("get",
9393
ElectricKiwiEndpoint.billingAddress.format(
9494
customerNumber=self.customer_number))
9595
check_status(billing_address.status)
96-
BillingAddress.from_dict(await billing_address.json())
96+
return BillingAddress.from_dict(await billing_address.json())
9797

9898
async def get_billing_frequency(self):
9999
billing_frequency = await self.auth.request("get", ElectricKiwiEndpoint.billingFrequency.format(
100100
customerNumber=self.customer_number))
101101
check_status(billing_frequency.status)
102-
BillingFrequency.from_dict(await billing_frequency.json())
102+
return BillingFrequency.from_dict(await billing_frequency.json())
103103

104104
# @paginated(by_query_params=get_next_page)
105105
async def get_billing_bills(self, limit = 5, offset = 0):
106106
billing_bills = await self.auth.request("get", ElectricKiwiEndpoint.billingBills.format(customerNumber=self.customer_number, limit=limit, offset=offset))
107107
check_status(billing_bills.status)
108-
Bills.from_dict(await billing_bills.json())
108+
return Bills.from_dict(await billing_bills.json())
109109

110110
async def get_billing_bill(self, bill_id):
111111
billing_bill = await self.auth.request("get",
112112
ElectricKiwiEndpoint.billingBill.format(
113113
customerNumber=self.customer_number,
114114
billId=bill_id))
115115
check_status(billing_bill.status)
116-
Bill.from_dict(await billing_bill.json())
116+
return Bill.from_dict(await billing_bill.json())
117117

118118
async def get_bill_file(self, bill_id):
119119
bill_file = await self.auth.request("get",
120120
ElectricKiwiEndpoint.billingBillFile.format(
121121
customerNumber=self.customer_number,
122122
billId=bill_id))
123123
check_status(bill_file.status)
124-
BillFile.from_dict(await bill_file.json())
124+
return BillFile.from_dict(await bill_file.json())
125125

126126
async def get_account_balance(self):
127127
account_balance = await self.auth.request("get",
128128
ElectricKiwiEndpoint.accountBalance.format(
129129
customerNumber=self.customer_number))
130130
check_status(account_balance.status)
131-
AccountBalance.from_dict(await account_balance.json())
131+
return AccountBalance.from_dict(await account_balance.json())
132132

133133
async def get_consumption_summary(self, start_date, end_date):
134134
consumption_summary = await self.auth.request("get", ElectricKiwiEndpoint.consumptionSummary.format(
135135
customerNumber=self.customer_number,
136136
connectionId=self.connection_id),
137137
json={start_date: start_date, end_date: end_date})
138138
check_status(consumption_summary.status)
139-
ConsumptionSummary.from_dict(await consumption_summary.json())
139+
return ConsumptionSummary.from_dict(await consumption_summary.json())
140140

141141
async def get_consumption_averages(self, start_date, end_date, group_by="week"):
142142
consumption_average = await self.auth.request("get", ElectricKiwiEndpoint.consumptionAverages.format(
@@ -145,19 +145,19 @@ async def get_consumption_averages(self, start_date, end_date, group_by="week"):
145145
json={start_date: start_date, end_date: end_date,
146146
group_by: group_by})
147147
check_status(consumption_average.status)
148-
ConsumptionAverage.from_dict(await consumption_average.json())
148+
return ConsumptionAverage.from_dict(await consumption_average.json())
149149

150150
async def get_hop_intervals(self):
151151
hop_intervals = await self.auth.request("get", ElectricKiwiEndpoint.hourOfPowerIntervals)
152152
check_status(hop_intervals.status)
153-
HopIntervals.from_dict(await hop_intervals.json())
153+
return HopIntervals.from_dict(await hop_intervals.json())
154154

155155
async def get_hop(self):
156156
get_hop = await self.auth.request("get", ElectricKiwiEndpoint.hourOfPowerByConnection.format(
157157
customerNumber=self.customer_number,
158158
connectionId=self.connection_id))
159159
check_status(get_hop.status)
160-
Hop.from_dict(await get_hop.json())
160+
return Hop.from_dict(await get_hop.json())
161161

162162
async def post_hop(self, hop_interval):
163163
data = {"start": hop_interval}
@@ -166,11 +166,11 @@ async def post_hop(self, hop_interval):
166166
connectionId=self.connection_id),
167167
json=data)
168168
check_status(post_hop.status)
169-
Hop.from_dict(await post_hop.json())
169+
return Hop.from_dict(await post_hop.json())
170170

171171
async def get_outage_info(self):
172172
outage_info = await self.auth.request("get",
173173
ElectricKiwiEndpoint.outageContactInformationForConnection.format(
174174
connectionId=self.connection_id))
175175
check_status(outage_info.status)
176-
OutageContact.from_dict(await outage_info.json())
176+
return OutageContact.from_dict(await outage_info.json())

tests/test_instance.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def __init__(
2222

2323
async def async_get_access_token(self) -> str:
2424
"""Return a valid access token."""
25-
25+
"""Authorization: Basic [client_id:client_secret]"""
2626
return cast(str, self._token)
2727

2828

0 commit comments

Comments
 (0)