Skip to content

[Confluence] ConfluenceCloud: add get_page_space - #1706

Merged
gonchik merged 1 commit into
atlassian-api:masterfrom
LuisFigueroaG:fix/confluence-cloud-get-page-space
Oct 26, 2026
Merged

gonchik merged 1 commit into
atlassian-api:masterfrom
LuisFigueroaG:fix/confluence-cloud-get-page-space

Conversation

@LuisFigueroaG

Copy link
Copy Markdown
Contributor

docs/confluence.rst documents confluence.get_page_space(page_id) ("Provide space key from content id"), and the Server client has it. The Cloud client (Confluence(url="https://<site>.atlassian.net") / ConfluenceCloud) doesn't, so it fails with:

AttributeError: 'Cloud' object has no attribute 'get_page_space'

This adds get_page_space(page_id) to Cloud, with the same behaviour as the Server client:

  • sends GET /wiki/rest/api/content/{id}?expand=space, the same v1 endpoint get_page_by_id() already uses;
  • returns the space key, or None when the response has no space.

Tests: added four test_get_page_space_* tests to tests/confluence/test_confluence_cloud.py (default call, no space, the final request URL, and a call through Confluence(url="https://test.atlassian.net")); they fail on master with the error above. The full pytest suite, tox -e mypy and bandit pass, and black and flake8 are clean on the changed files. I haven't run it against a real Confluence Cloud site.

docs/confluence.rst documents get_page_space(page_id), and the Server
client has it, but the Cloud client does not, so
Confluence(url="https://<site>.atlassian.net") and ConfluenceCloud raise
"'Cloud' object has no attribute 'get_page_space'".

Add get_page_space to Cloud with the same behaviour as the Server
client: it requests /wiki/rest/api/content/{id}?expand=space and returns
the space key, or None when the page has no space.
@gonchik
gonchik merged commit 8d738d6 into atlassian-api:master Oct 26, 2026
4 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants