tried example.py - fails with missing authentication
ansash opened this issue · 2 comments
Hi - thanks in advance for the work !
Used the example to create my own test.py with eMail/Password/Serial from discovergy webpage.
Script is failing with following mesasge:
Traceback (most recent call last):
File "/root/discovergy_export.py", line 17, in
asyncio.run(main())
File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
return future.result()
File "/root/discovergy_export.py", line 8, in main
discovergy = Discovergy(email="USER@DOMAIN.de", password="12345suitcase")
TypeError: init() missing 1 required positional argument: 'authentication'
what am I missing ?
Best Regards !
The example.py
in the repository is using the main
branch. I've made some API changes recently.
Following example should work with 1.2.1
:
import asyncio
import json
from pprint import pprint
import pydiscovergy
from pydiscovergy.authentication import BasicAuth
async def main():
dis = pydiscovergy.Discovergy(email="example@example.org", password="example", authentication=BasicAuth())
meters = await dis.get_meters()
for meter in meters:
if meter.full_serial_number == "1ESY1161978584":
reading = await discovergy.meter_last_reading(meter.meter_id)
pprint(reading)
asyncio.run(main())
nearly there - new error:
NameError: name 'discovergy' is not defined
however - this minor thing I'll lookup for myself.
Thanks a lot !