Skip to content

Commit d74c007

Browse files
committed
Fix cli to use country instead of region
1 parent 218600f commit d74c007

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

karcher/cli.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ def __init__(
4040
self,
4141
debug: int = 0,
4242
output: str = 'json',
43-
region: Region = Region.EU):
43+
country: str = 'GB'):
4444
self.debug = debug
4545
self.output = output
46-
self.region = region
46+
self.country = country
4747

4848
def print(self, result):
4949
data_variable = getattr(result, 'data', None)
@@ -64,21 +64,20 @@ def print(self, result):
6464
default='json',
6565
help='Output format. Default: "json"')
6666
@click.option(
67-
'-r',
68-
'--region',
69-
type=click.Choice([Region.EU, Region.US, Region.CN]),
70-
default=Region.EU,
71-
help='Region of the server to query. Default: "eu"')
67+
'-c',
68+
'--country',
69+
default='GB',
70+
help='Country of the server to query. Default: "GB"')
7271
@click.pass_context
73-
def cli(ctx: click.Context, debug: int, output: str, region: Region):
72+
def cli(ctx: click.Context, debug: int, output: str, country: str):
7473
"""Tool for connectiong and getting information from Kärcher Home Robots."""
7574
level = logging.INFO
7675
if debug > 0:
7776
level = logging.DEBUG
7877

7978
logging.basicConfig(level=level)
8079

81-
ctx.obj = GlobalContextObject(debug=debug, output=output, region=region)
80+
ctx.obj = GlobalContextObject(debug=debug, output=output, country=country.upper())
8281

8382

8483
def safe_cli():
@@ -96,9 +95,9 @@ def safe_cli():
9695
@click.pass_context
9796
@coro
9897
async def urls(ctx: click.Context):
99-
"""Get region information."""
98+
"""Get URL information."""
10099

101-
kh = await KarcherHome.create(region=ctx.obj.region)
100+
kh = await KarcherHome.create(country=ctx.obj.country)
102101
d = await kh.get_urls()
103102

104103
ctx.obj.print(d)
@@ -112,7 +111,7 @@ async def urls(ctx: click.Context):
112111
async def login(ctx: click.Context, username: str, password: str):
113112
"""Get user session tokens."""
114113

115-
kh = await KarcherHome.create(region=ctx.obj.region)
114+
kh = await KarcherHome.create(country=ctx.obj.country)
116115
ctx.obj.print(kh.login(username, password))
117116

118117

@@ -125,7 +124,7 @@ async def login(ctx: click.Context, username: str, password: str):
125124
async def devices(ctx: click.Context, username: str, password: str, auth_token: str):
126125
"""List all devices."""
127126

128-
kh = await KarcherHome.create(region=ctx.obj.region)
127+
kh = await KarcherHome.create(country=ctx.obj.country)
129128
if auth_token is not None:
130129
kh.login_token(auth_token, '')
131130
elif username is not None and password is not None:
@@ -160,7 +159,7 @@ async def device_properties(
160159
device_id: str):
161160
"""Get device properties."""
162161

163-
kh = await KarcherHome.create(region=ctx.obj.region)
162+
kh = await KarcherHome.create(country=ctx.obj.country)
164163
if auth_token is not None:
165164
kh.login_token(auth_token, mqtt_token)
166165
elif username is not None and password is not None:

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,15 @@
77
name='karcher-home',
88
packages=['karcher'],
99
include_package_data=True,
10-
version='0.4',
10+
version='0.4.1',
1111
license='MIT',
1212
description='Kärcher Home Robots client',
1313
long_description=open('README.md').read(),
1414
long_description_content_type='text/markdown',
1515
author='Lauris BH',
1616
author_email='[email protected]',
1717
url='https://github.com/lafriks/python-karcher',
18-
download_url='https://github.com/lafriks/python-karcher/releases/download/v0.4/karcher-home-0.4.tar.gz',
18+
download_url='https://github.com/lafriks/python-karcher/releases/download/v0.4.1/karcher-home-0.4.1.tar.gz',
1919
platforms='any',
2020
install_requires=[
2121
'click',

0 commit comments

Comments
 (0)