Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

authentication credentials are validated even with --dry-run in md2cf v2.1.0 #76

Open
jimstein3d opened this issue Apr 27, 2023 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@jimstein3d
Copy link
Contributor

jimstein3d commented Apr 27, 2023

with this command line "md2cf --host 'https://<my secret>.atlassian.net/wiki/rest/api' --username '<my secret>' --password '<my secret>' --space <my secret> --dry-run --no-gitignore 'C:\my-project\docs'" and with
"pip install md2cf==2.0.2" it will work.
But if I then do this "pip install md2cf==2.1.0" and run the command line again I now get this error:

Traceback (most recent call last):
File "", line 198, in run_module_as_main
File "", line 88, in run_code
File "C:\Python311\Scripts\md2cf.exe_main
.py", line 7, in
File "C:\Python311\Lib\site-packages\md2cf_main
.py", line 384, in main
space_info = confluence.get_space(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\md2cf\api.py", line 259, in get_space
return self._get(f"content?spaceKey={space}/")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\md2cf\api.py", line 70, in _get
return self._request("GET", path, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\site-packages\md2cf\api.py", line 66, in _request
r.raise_for_status()
File "C:\Python311\Lib\site-packages\requests\models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://<my secret>.atlassian.net/wiki/rest/api/space/<my secret>/?expand=homepage

NOTE: this url (https://.atlassian.net/wiki/rest/api/space/<my secret>/?expand=homepage) in the webbrowser print json content.

EDIT: the difference was that --dry-run is not respected in the new version. I still have problems with authentication credentials with the old version with --dry-run removed from command line.

@jimstein3d jimstein3d changed the title requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url with md2cf v2.1.0 authentication credentials are validated even with --dry-run in md2cf v2.1.0 Apr 27, 2023
@iamjackg iamjackg added bug Something isn't working enhancement New feature or request good first issue Good for newcomers and removed bug Something isn't working labels Oct 22, 2023
@iamjackg
Copy link
Owner

Unfortunately it's actually necessary to get space information even during a dry run: it's the only way to determine the ID of the top-level page in a space when using the --top-level argument. Before version 2.1 that was done incorrectly. I could look into possibly not allowing that option during a dry run, or at least warning the user about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants