Authorization issues when using environment variables
kasserver-dns: 0.4.0
C:\Users\username\.netrc:
machine kasapi.kasserver.com
Environment variables:
KASSERVER_USER=<redacted username>
KASSERVER_PASSWORD=<redacted password>
When I run kasserver-dns list example.com, I get the following error stacktrace:
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Python312\Scripts\kasserver-dns.exe\__main__.py", line 7, in <module>
File "C:\Python312\Lib\site-packages\click\core.py", line 1157, in __call__
return self.main(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\click\core.py", line 1078, in main
rv = self.invoke(ctx)
^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\click\core.py", line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\click\core.py", line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\click\core.py", line 783, in invoke
return __callback(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\kasserver\kasserver_dns.py", line 52, in list_command
records = kas.get_dns_records(zone_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\kasserver\__init__.py", line 104, in get_dns_records
res = self._request("get_dns_settings", {"zone_host": zone_name})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\kasserver\__init__.py", line 91, in _request
return _send_request(request)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\kasserver\__init__.py", line 80, in _send_request
result = self._client.service.KasApi(json.dumps(request))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\zeep\proxy.py", line 46, in __call__
return self._proxy._binding.send(
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\zeep\wsdl\bindings\soap.py", line 135, in send
return self.process_reply(client, operation_obj, response)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\zeep\wsdl\bindings\soap.py", line 229, in process_reply
return self.process_error(doc, operation)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python312\Lib\site-packages\zeep\wsdl\bindings\soap.py", line 329, in process_error
raise Fault(
zeep.exceptions.Fault: got_no_login_data
Does it mean that the values from the environment variables are not picked up?
you dont need the .netrc file you added the env variables
If I provide the credentials through env variables, I do not need to specify the API URL (in the config file)?
If I provide the credentials through env variables, I do not need to specify the API URL (in the config file)?
Yes, worked like a charm for me without it
Had a similar error when using it with the .netrc file and env variables.
C:\Users\username.netrc:
machine kasapi.kasserver.com
There is a misunderstanding here. machine <xxx> does not define an API endpoint. It starts a new .netrc configuration block that is valid when authenticating against kasapi.kasserver.com. If you define a config block for kasserver, you also have to provide login and password.
A .netrc file can be used for multiple remotes / services. It's a standard file format in the Linux world (https://www.gnu.org/software/inetutils/manual/html_node/The-_002enetrc-file.html) but not really used on Windows.
You either provide your credentials using .netrc or via env vars.