Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Lash-L committed Mar 2, 2023
2 parents 70d3c0a + fcdf981 commit a9a83bc
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 9 deletions.
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

<!--next-version-placeholder-->

## v0.6.0 (2023-02-27)
### Feature
* Added base exception class ([`3cb40b8`](https://github.com/Lash-L/southern_company_api/commit/3cb40b8935839a467cd08bd4b00798996ce2b1c3))

### Fix
* Added request token_expiry to authenticate ([`33cc388`](https://github.com/Lash-L/southern_company_api/commit/33cc388ec3e465a33edb2e56693048044954de2b))

## v0.5.1 (2023-02-23)
### Fix
* Repaired test ([`ecb6dfb`](https://github.com/Lash-L/southern_company_api/commit/ecb6dfb44b5706b982772259a20346dcc422bd26))
* Always authenticate on jwt ([`42bface`](https://github.com/Lash-L/southern_company_api/commit/42bfaceb623d27757c233ab917b2bb2c0d17cfd7))

## v0.5.0 (2023-02-22)
### Feature
* Pulled out session and service_point ([`fa5863f`](https://github.com/Lash-L/southern_company_api/commit/fa5863f00813cf0a4013c347776a18c5267bfa43))
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "southern-company-api"
version = "0.5.0"
version = "0.6.0"
description = "Control Southern company websites with this api"
authors = ["Luke <conway220@gmail.com>"]
license = "MIT"
Expand Down
2 changes: 1 addition & 1 deletion src/southern_company_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from .company import COMPANY_MAP, Company
from .parser import SouthernCompanyAPI, get_request_verification_token

__version__ = "0.5.0"
__version__ = "0.6.0"

__all__ = [
"Account",
Expand Down
18 changes: 11 additions & 7 deletions src/southern_company_api/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
class InvalidLogin(Exception):
class SouthernCompanyException(Exception):
pass


class CantReachSouthernCompany(Exception):
class InvalidLogin(SouthernCompanyException):
pass


class NoRequestTokenFound(Exception):
class CantReachSouthernCompany(SouthernCompanyException):
pass


class NoJwtTokenFound(Exception):
class NoRequestTokenFound(SouthernCompanyException):
pass


class NoScTokenFound(Exception):
class NoJwtTokenFound(SouthernCompanyException):
pass


class AccountFailure(Exception):
class NoScTokenFound(SouthernCompanyException):
pass


class UsageDataFailure(Exception):
class AccountFailure(SouthernCompanyException):
pass


class UsageDataFailure(SouthernCompanyException):
pass
4 changes: 4 additions & 0 deletions src/southern_company_api/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ async def connect(self) -> None:
async def authenticate(self) -> bool:
"""Determines if you can authenticate with Southern Company with given login"""
self._request_token = await get_request_verification_token(self.session)
self._request_token_expiry = datetime.datetime.now() + datetime.timedelta(
hours=3
)
self._sc = await self._get_sc_web_token()
return True

Expand Down Expand Up @@ -135,6 +138,7 @@ async def _get_sc_web_token(self) -> str:
else:
return sc_data.group(1)
else:
self._sc = None
raise NoScTokenFound("Login request did not return a sc token")

async def _get_southern_jwt_cookie(self) -> str:
Expand Down

0 comments on commit a9a83bc

Please sign in to comment.