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

Add some handling for tag edge cases #118

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nate-woythaler
Copy link

  • Properly handle updating tags if the page doesn't already have them
  • JSON-ify tags so Confluence can properly consume the data

Fixes #117

- Properly handle updating tags if the page doesn't already have them
- JSON-ify tags so Confluence can properly consume the data

Fixes iamjackg#117
@@ -243,7 +246,8 @@ def add_labels(self, page, labels):
# return self.api.content(page.id).post(
return self._post(
f"content/{page.id}/label",
data=[{"name": label, "type": "global"} for label in labels],
data=json.dumps([{"name": label, "type": "global"} for label in labels]),
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is the correct approach, but our Confluence instance was giving me back HTTP 415s when submitting binary data via the **kwargs expansion on line 68

415 Client Error: Unsupported Media Type for url: https://${CONFLUENCE_URL}/rest/api/content/515736017/label - b''

@nate-woythaler
Copy link
Author

nate-woythaler commented Nov 13, 2023

  • TODO: fix tests

Chaining the `get` calls would mean a messy amount of Mocks. Just use a
single `get` call and if it's empty return a dummy struct for sanity's
sake.

Also `get('name')` on the returned struct since we run into issues with
Mocking without it.

Fixes iamjackg#117
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.

AttributeError when adding new tags to an existing page
1 participant