Skip to content

Commit

Permalink
Use mandatory args
Browse files Browse the repository at this point in the history
  • Loading branch information
jcjones committed Jun 6, 2024
1 parent 22e36b7 commit a6f801f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ async def main():
args = PARSER.parse_args()
log_format = "%(asctime)s - %(name)s - %(levelname)s - %(message)s"
logging.basicConfig(level=args.log_level, format=log_format)
wc = WatersmartClient(args.url, args.email, args.password)
wc = WatersmartClient(url=args.url, email=args.email, password=args.password)
try:
data = await wc.usage()
for datapoint in sorted(data, key=lambda x: x["read_datetime"]):
Expand Down
2 changes: 1 addition & 1 deletion src/watersmart/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class WatersmartClientAuthenticationError(WatersmartClientError):


class WatersmartClient:
def __init__(self, url, email, password, session=None):
def __init__(self, *, url, email, password, session=None):
self._url = url
self._email = email
self._password = password
Expand Down
4 changes: 3 additions & 1 deletion src/watersmart/usage_data_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,6 @@ def test_amend_with_local_ts_in_utc():
@pytest.mark.asyncio
async def test_disallow_non_watersmart_urls():
with pytest.raises(AssertionError):
WatersmartClient("https://wsmart.example", "e@mail", "passw4rd")
WatersmartClient(
url="https://wsmart.example", email="e@mail", password="passw4rd"
)

0 comments on commit a6f801f

Please sign in to comment.