Skip to content

Commit

Permalink
fix: made accounts private
Browse files Browse the repository at this point in the history
  • Loading branch information
Lash-L committed Feb 8, 2023
1 parent 7579f29 commit 33a812a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/southern_company_api/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ def __init__(self, username: str, password: str):
self.jwt: typing.Optional[str] = None
self.sc: typing.Optional[str] = None
self.request_token: typing.Optional[str] = None
self.accounts: typing.Optional[List[Account]] = None
self._accounts: typing.Optional[List[Account]] = None

@property
def accounts(self) -> typing.Optional[List[Account]]:
return self._accounts

async def connect(self) -> None:
"""
Expand All @@ -53,7 +57,7 @@ async def connect(self) -> None:
self.request_token = await get_request_verification_token()
self.sc = await self._get_sc_web_token()
self.jwt = await self.get_jwt()
self.accounts = await self.get_accounts()
self._accounts = await self.get_accounts()

async def authenticate(self) -> bool:
"""Determines if you can authenticate with Southern Company with given login"""
Expand Down Expand Up @@ -202,5 +206,5 @@ async def get_accounts(self) -> List[Account]:
company=COMPANY_MAP.get(account["Company"], Company.GPC),
)
)
self.accounts = accounts
self._accounts = accounts
return accounts
1 change: 1 addition & 0 deletions tests/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,3 +123,4 @@ async def test_ga_power_get_accounts():
sca.jwt = "sample"
response_token: typing.List[Account] = await sca.get_accounts()
assert response_token[0].name == "Home Energy"
assert sca.accounts == response_token

0 comments on commit 33a812a

Please sign in to comment.