atlassian-python-api icon indicating copy to clipboard operation
atlassian-python-api copied to clipboard

[confluence] The confluence.move_page() function is invalid

Open hyj1116 opened this issue 1 year ago • 3 comments

Hi Gonchik Tsymzhitov,

Thanks for sharing the "atlassian-python-api · PyPI" library.

I found the confluence.move_page() function is invalid because it cannot move a page which has child pages to be the other page's child. My code is as follows:

res = confluence.move_page(
    space_key,
    source_page_id,
    target_page_id,
    target_page_title,
    "append",
)
print(res) # None

Could you please help check the confluence.move_page() function?

Thanks.

hyj1116 avatar Jul 25 '22 07:07 hyj1116

Hi @hyj1116 , in which version of Confluence you did it?

gonchik avatar Sep 18 '22 12:09 gonchik

Hi @gonchik , I found this issue on Confluence v7.13.8. It also fails in Confluence 7.19.1 The error message is as follows:

`=============== 2022-09-18 22:28:03.728977 ================ <atlassian.confluence.Confluence object at 0x10f762fa0> Traceback (most recent call last): File "/usr/local/lib/python3.9/site-packages/atlassian/confluence.py", line 2766, in raise_for_status j = response.json() File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 900, in json return complexjson.loads(self.text, **kwargs) File "/usr/local/Cellar/[email protected]/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/init.py", line 346, in loads return _default_decoder.decode(s) File "/usr/local/Cellar/[email protected]/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 337, in decode obj, end = self.raw_decode(s, idx=_w(s, 0).end()) File "/usr/local/Cellar/[email protected]/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 355, in raw_decode raise JSONDecodeError("Expecting value", s, err.value) from None json.decoder.JSONDecodeError: Expecting value: line 3 column 1 (char 6)

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/Users/huangyongjie/Side_Project/python-utility/Confluence/Weekly_Report/tidy_up_sw_weekly_report_pages copy.py", line 43, in res = confluence.move_page( File "/usr/local/lib/python3.9/site-packages/atlassian/confluence.py", line 728, in move_page return self.post(url, params=params, headers=self.no_check_headers) File "/usr/local/lib/python3.9/site-packages/atlassian/rest_client.py", line 309, in post response = self.request( File "/usr/local/lib/python3.9/site-packages/atlassian/rest_client.py", line 242, in request self.raise_for_status(response) File "/usr/local/lib/python3.9/site-packages/atlassian/confluence.py", line 2769, in raise_for_status response.raise_for_status() File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 943, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 500 Server Error: for url: https://confluence.xxxxx.com:xxxx/pages/movepage.action?spaceKey=~this_is_username%40accton.com&pageId=410025986&targetTitle=test+migrage+page+result&targetId=413340872&position=append`

hyj1116 avatar Sep 18 '22 14:09 hyj1116

@hyj1116 made on my env, it works. did you find that error in last releases?

gonchik avatar Feb 24 '23 20:02 gonchik