1
0
Fork 0

Compare commits

...

8 Commits

9 changed files with 13 additions and 16 deletions

4
.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
__pycache__/
api/authcache/
api/__pycache__/
settings.py

Binary file not shown.

View File

@ -18,6 +18,7 @@ import sys
from aiohttp import ClientSession
from api import api
from settings import *
_LOGGER: logging.Logger = logging.getLogger(__name__)
_LOGGER.addHandler(logging.StreamHandler(sys.stdout))
@ -26,12 +27,6 @@ CONSOLE: logging.Logger = logging.getLogger("console")
CONSOLE.addHandler(logging.StreamHandler(sys.stdout))
CONSOLE.setLevel(logging.INFO)
# Optional default Anker Account credentials to be used
USER = ""
PASSWORD = ""
COUNTRY = ""
async def main() -> None:
"""Run main to export energy history from cloud."""
global USER, PASSWORD, COUNTRY # noqa: PLW0603

4
example_settings.py Normal file
View File

@ -0,0 +1,4 @@
# Optional default Anker Account credentials to be used
USER = ""
PASSWORD = ""
COUNTRY = ""

View File

@ -21,6 +21,7 @@ import time
from aiohttp import ClientSession
from aiohttp.client_exceptions import ClientError
from api import api, errors
from settings import *
_LOGGER: logging.Logger = logging.getLogger(__name__)
_LOGGER.addHandler(logging.StreamHandler(sys.stdout))
@ -29,11 +30,6 @@ CONSOLE: logging.Logger = logging.getLogger("console")
CONSOLE.addHandler(logging.StreamHandler(sys.stdout))
CONSOLE.setLevel(logging.INFO)
# Optional default Anker Account credentials to be used
USER = ""
PASSWORD = ""
COUNTRY = ""
RANDOMIZE = True # Global flag to save randomize decission
RANDOMDATA = {} # Global dict for randomized data, printed at the end

View File

@ -15,6 +15,7 @@ import time
from aiohttp import ClientSession
from api import api
from settings import *
_LOGGER: logging.Logger = logging.getLogger(__name__)
_LOGGER.addHandler(logging.StreamHandler(sys.stdout))
@ -23,10 +24,6 @@ CONSOLE: logging.Logger = logging.getLogger("console")
CONSOLE.addHandler(logging.StreamHandler(sys.stdout))
CONSOLE.setLevel(logging.INFO)
# Optional default Anker Account credentials to be used
USER = ""
PASSWORD = ""
COUNTRY = ""
REFRESH = 30 # default refresh interval in seconds

View File

@ -8,6 +8,7 @@ import sys
from aiohttp import ClientSession
from api import api
from settings import *
_LOGGER: logging.Logger = logging.getLogger(__name__)
_LOGGER.addHandler(logging.StreamHandler(sys.stdout))
@ -23,7 +24,7 @@ async def main() -> None:
try:
async with ClientSession() as websession:
myapi = api.AnkerSolixApi(
"username@domain.com", "password", "de", websession, _LOGGER
USER, PASSWORD, COUNTRY, websession, _LOGGER
)
# show login response