Skip to content

Commit

Permalink
Merge pull request #41 from faanskit/login_bug
Browse files Browse the repository at this point in the history
Fixed for bug #40
  • Loading branch information
faanskit authored Jun 17, 2024
2 parents e996051 + 706d9ba commit f874a99
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
14 changes: 10 additions & 4 deletions pycheckwatt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,22 @@ async def login(self):
encoded_credentials = base64.b64encode(credentials.encode("utf-8")).decode(
"utf-8"
)
endpoint = "/user/LoginEiB?audience=eib"

endpoint = "/user/Login?audience=eib"
# Define headers with the encoded credentials
headers = {
**self._get_headers(),
"authorization": f"Basic {encoded_credentials}",
}
payload = {
"OneTimePassword": "",
}

async with self.session.get(
self.base_url + endpoint, headers=headers
timeout_seconds = 10
async with self.session.post(
self.base_url + endpoint,
headers=headers,
json=payload,
timeout=timeout_seconds,
) as response:
data = await response.json()
if response.status == 200:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

MIN_PY_VERSION = "3.10"
PACKAGES = find_packages()
VERSION = "0.2.6"
VERSION = "0.2.7"

setup(
name="pycheckwatt",
Expand Down

0 comments on commit f874a99

Please sign in to comment.