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

Trying to set title of Confluence page

Open francis-vila opened this issue 1 year ago • 0 comments

Is there a way of editing the title of a Confluence page using the atlassian-python-api? I tried using

confluence.set_page_property(page_id, {'title': new_page_title})

but I get an error <Response [500]>

In detail:

pytest_test.py::test_remove_all_qqq_from_titles FAILED                   [100%]
venv\conversion_scripts\pytest_test.py:103 (test_remove_all_qqq_from_titles)
def test_remove_all_qqq_from_titles():
>       toto = cu.remove_all_qqq_from_titles('TS')

pytest_test.py:105: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
convert_utils.py:286: in remove_all_qqq_from_titles
    cc.set_page_property(page_id, {'title': new_page_title})
..\lib\site-packages\atlassian\confluence.py:1768: in set_page_property
    response = self.post(path=url, data=json_data)
..\lib\site-packages\atlassian\rest_client.py:309: in post
    response = self.request(
..\lib\site-packages\atlassian\rest_client.py:242: in request
    self.raise_for_status(response)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <atlassian.confluence.Confluence object at 0x000001DAEAC19550>
response = <Response [500]>

    def raise_for_status(self, response):
        """
        Checks the response for an error status and raises an exception with the error message provided by the server
        :param response:
        :return:
        """
        if 400 <= response.status_code < 600:
            try:
                j = response.json()
                error_msg = j["message"]
            except Exception:
                response.raise_for_status()
            else:
>               raise HTTPError(error_msg, response=response)
E               requests.exceptions.HTTPError

..\lib\site-packages\atlassian\confluence.py:2774: HTTPError

francis-vila avatar Jul 25 '22 14:07 francis-vila