Repository navigation
[Confluence] ConfluenceCloud: add set_page_label and remove_page_label - #1721
Merged
gonchik merged 1 commit intoNov 18, 2026
Merged
Conversation
docs/confluence.rst documents set_page_label(page_id, label) and
remove_page_label(page_id, label), and the Server client has both, but
the Cloud client does not, so Confluence(url="https://<site>.atlassian.net")
and ConfluenceCloud raise AttributeError for them.
Add both to Cloud with the same arguments and error mapping as the
Server client. set_page_label sends POST /wiki/rest/api/content/{id}/label
with a global label, and remove_page_label sends
DELETE /wiki/rest/api/content/{id}/label?name=..., which also accepts
label names containing "/".
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1721 +/- ##
==========================================
+ Coverage 65.49% 65.52% +0.03%
==========================================
Files 107 107
Lines 19440 19462 +22
Branches 2129 2132 +3
==========================================
+ Hits 12732 12753 +21
+ Misses 6001 6000 -1
- Partials 707 709 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
docs/confluence.rstdocumentsconfluence.set_page_label(page_id, label)andconfluence.remove_page_label(page_id, label), and the Server client has both. The Cloud client (Confluence(url="https://<site>.atlassian.net")/ConfluenceCloud) doesn't, so the calls fail with:Clouddoes haveadd_content_labels()andremove_content_label(), but they take a different payload/path, so code written against the documented methods has to be changed for Cloud.This adds both methods to
Cloudwith the same arguments, return value and error mapping as the Server client:set_page_labelsendsPOST /wiki/rest/api/content/{id}/labelwith{"prefix": "global", "name": label}(addLabelsToContentin the Cloud v1 labels reference); a 404 raisesApiError.remove_page_labelsendsDELETE /wiki/rest/api/content/{id}/label?name={label}(removeLabelFromContentUsingQueryParameter). I used the query parameter version rather than/label/{label}because the path version rejects label names with/. A 403 raisesApiPermissionErrorand a 404 raisesApiError, like Server.I also added a line to both entries in
docs/confluence.rstsaying they work on Cloud.Tests: added eight tests to
tests/confluence/test_confluence_cloud.pycovering the request arguments, the final URLs (including?name=team%2Freport), the 403/404 errors, and calls throughConfluence(url="https://test.atlassian.net"). All of them fail on master with the error above. The full pytest suite,tox -e flake8,black,mypy,bandit,doc8pass. I haven't run it against a real Confluence Cloud site.