markdown-to-confluence 0.4.6__py3-none-any.whl → 0.4.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {markdown_to_confluence-0.4.6.dist-info → markdown_to_confluence-0.4.8.dist-info}/METADATA +28 -11
- markdown_to_confluence-0.4.8.dist-info/RECORD +34 -0
- md2conf/__init__.py +1 -1
- md2conf/__main__.py +18 -1
- md2conf/api.py +37 -23
- md2conf/converter.py +255 -135
- md2conf/csf.py +9 -7
- md2conf/domain.py +4 -0
- md2conf/drawio.py +5 -3
- md2conf/latex.py +2 -2
- md2conf/matcher.py +1 -3
- md2conf/processor.py +1 -1
- md2conf/publisher.py +1 -1
- md2conf/scanner.py +12 -4
- md2conf/xml.py +8 -5
- markdown_to_confluence-0.4.6.dist-info/RECORD +0 -34
- {markdown_to_confluence-0.4.6.dist-info → markdown_to_confluence-0.4.8.dist-info}/WHEEL +0 -0
- {markdown_to_confluence-0.4.6.dist-info → markdown_to_confluence-0.4.8.dist-info}/entry_points.txt +0 -0
- {markdown_to_confluence-0.4.6.dist-info → markdown_to_confluence-0.4.8.dist-info}/licenses/LICENSE +0 -0
- {markdown_to_confluence-0.4.6.dist-info → markdown_to_confluence-0.4.8.dist-info}/top_level.txt +0 -0
- {markdown_to_confluence-0.4.6.dist-info → markdown_to_confluence-0.4.8.dist-info}/zip-safe +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: markdown-to-confluence
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.8
|
|
4
4
|
Summary: Publish Markdown files to Confluence wiki
|
|
5
5
|
Author-email: Levente Hunyadi <hunyadi@gmail.com>
|
|
6
6
|
Maintainer-email: Levente Hunyadi <hunyadi@gmail.com>
|
|
@@ -26,20 +26,20 @@ License-File: LICENSE
|
|
|
26
26
|
Requires-Dist: certifi>=2025.8.3; python_version < "3.10"
|
|
27
27
|
Requires-Dist: json_strong_typing>=0.4
|
|
28
28
|
Requires-Dist: lxml>=6.0
|
|
29
|
-
Requires-Dist: markdown>=3.
|
|
29
|
+
Requires-Dist: markdown>=3.9
|
|
30
30
|
Requires-Dist: pymdown-extensions>=10.16
|
|
31
31
|
Requires-Dist: PyYAML>=6.0
|
|
32
32
|
Requires-Dist: requests>=2.32
|
|
33
33
|
Requires-Dist: truststore>=0.10; python_version >= "3.10"
|
|
34
|
-
Requires-Dist: typing-extensions>=4.
|
|
34
|
+
Requires-Dist: typing-extensions>=4.15; python_version < "3.12"
|
|
35
35
|
Provides-Extra: dev
|
|
36
|
-
Requires-Dist: markdown_doc>=0.1.
|
|
37
|
-
Requires-Dist: types-lxml>=2025.
|
|
38
|
-
Requires-Dist: types-markdown>=3.
|
|
36
|
+
Requires-Dist: markdown_doc>=0.1.5; python_version >= "3.10" and extra == "dev"
|
|
37
|
+
Requires-Dist: types-lxml>=2025.8.25; extra == "dev"
|
|
38
|
+
Requires-Dist: types-markdown>=3.9; extra == "dev"
|
|
39
39
|
Requires-Dist: types-PyYAML>=6.0; extra == "dev"
|
|
40
40
|
Requires-Dist: types-requests>=2.32; extra == "dev"
|
|
41
|
-
Requires-Dist: mypy>=1.
|
|
42
|
-
Requires-Dist: ruff>=0.
|
|
41
|
+
Requires-Dist: mypy>=1.18; extra == "dev"
|
|
42
|
+
Requires-Dist: ruff>=0.13; extra == "dev"
|
|
43
43
|
Provides-Extra: formulas
|
|
44
44
|
Requires-Dist: matplotlib>=3.9; extra == "formulas"
|
|
45
45
|
Dynamic: license-file
|
|
@@ -425,9 +425,9 @@ Use the pseudo-language `csf` in a Markdown code block to pass content directly
|
|
|
425
425
|
|
|
426
426
|
### Ignoring files
|
|
427
427
|
|
|
428
|
-
Skip files in a directory with rules defined in `.mdignore`. Each rule should occupy a single line. Rules follow the syntax (and constraints) of [fnmatch](https://docs.python.org/3/library/fnmatch.html#fnmatch.fnmatch). Specifically, `?` matches any single character, and `*` matches zero or more characters. For example, use `up-*.md` to exclude Markdown files that start with `up-`. Lines that start with `#` are treated as comments.
|
|
428
|
+
Skip files and subdirectories in a directory with rules defined in `.mdignore`. Each rule should occupy a single line. Rules follow the syntax (and constraints) of [fnmatch](https://docs.python.org/3/library/fnmatch.html#fnmatch.fnmatch). Specifically, `?` matches any single character, and `*` matches zero or more characters. For example, use `up-*.md` to exclude Markdown files that start with `up-`. Lines that start with `#` are treated as comments.
|
|
429
429
|
|
|
430
|
-
Files that don't have the extension `*.md` are skipped automatically. Hidden directories (whose name starts with `.`) are not recursed into.
|
|
430
|
+
Files that don't have the extension `*.md` are skipped automatically. Hidden directories (whose name starts with `.`) are not recursed into. To skip an entire directory, add the name of the directory without a trailing `/`.
|
|
431
431
|
|
|
432
432
|
Relative paths to items in a nested directory are not supported. You must put `.mdignore` in the same directory where the items to be skipped reside.
|
|
433
433
|
|
|
@@ -501,7 +501,7 @@ You can add [Mermaid diagrams](https://mermaid.js.org/) to your Markdown documen
|
|
|
501
501
|
|
|
502
502
|
*md2conf* offers two options to publish the diagram:
|
|
503
503
|
|
|
504
|
-
1. Pre-render into an image (command-line option `--render-mermaid`). The source file or code block is interpreted by and converted into a PNG or SVG image with the Mermaid diagram utility [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). The generated image is then uploaded to Confluence as an attachment to the page.
|
|
504
|
+
1. Pre-render into an image (command-line option `--render-mermaid`). The source file or code block is interpreted by and converted into a PNG or SVG image with the Mermaid diagram utility [mermaid-cli](https://github.com/mermaid-js/mermaid-cli). The generated image is then uploaded to Confluence as an attachment to the page.
|
|
505
505
|
2. Display on demand (command-line option `--no-render-mermaid`). The code block is transformed into a [diagram macro](https://stratus-addons.atlassian.net/wiki/spaces/MDFC/overview), which is processed by Confluence. You need a separate [marketplace app](https://marketplace.atlassian.com/apps/1226567/mermaid-diagrams-for-confluence) to turn macro definitions into images when a Confluence page is visited.
|
|
506
506
|
|
|
507
507
|
If you are running into issues with the pre-rendering approach (e.g. misaligned labels in the generated image), verify if `mermaid-cli` can process the Mermaid source:
|
|
@@ -512,6 +512,14 @@ mmdc -i sample.mmd -o sample.png -b transparent --scale 2
|
|
|
512
512
|
|
|
513
513
|
Ensure that `mermaid-cli` is set up, refer to *Installation* for instructions.
|
|
514
514
|
|
|
515
|
+
Note that `mermaid-cli` has some implicit dependencies (e.g. a headless browser) that may not be immediately available in a CI/CD environment such as GitHub Actions. Refer to the `Dockerfile` in the *md2conf* project root, or [mermaid-cli documentation](https://github.com/mermaid-js/mermaid-cli) on how to install these dependencies such as a `chromium-browser` and various fonts.
|
|
516
|
+
|
|
517
|
+
### Alignment
|
|
518
|
+
|
|
519
|
+
You can configure diagram and image alignment using the JSON/YAML front-matter attribute `alignment` or the command-line argument of the same name. Possible values are `center` (default), `left` and `right`. The value configured in the Markdown file front-matter takes precedence.
|
|
520
|
+
|
|
521
|
+
Unfortunately, not every third-party app supports every alignment variant. For example, the draw\.io marketplace app supports left and center but not right alignment; and diagrams produced by the Mermaid marketplace app are always centered, ignoring the setting for alignment.
|
|
522
|
+
|
|
515
523
|
### Links to attachments
|
|
516
524
|
|
|
517
525
|
If *md2conf* encounters a Markdown link that points to a file in the directory hierarchy being synchronized, it automatically uploads the file as an attachment to the Confluence page. Activating the link in Confluence downloads the file. Typical examples include PDFs (`*.pdf`), word processor documents (`*.docx`), spreadsheets (`*.xlsx`), plain text files (`*.txt`) or logs (`*.log`). The MIME type is set based on the file type.
|
|
@@ -581,8 +589,17 @@ options:
|
|
|
581
589
|
--headers KEY=VALUE [KEY=VALUE ...]
|
|
582
590
|
Apply custom headers to all Confluence API requests.
|
|
583
591
|
--webui-links Enable Confluence Web UI links. (Typically required for on-prem versions of Confluence.)
|
|
592
|
+
--alignment {center,left,right}
|
|
593
|
+
Alignment for block-level images and formulas (default: 'center').
|
|
594
|
+
--use-panel Transform admonitions and alerts into a Confluence custom panel.
|
|
584
595
|
```
|
|
585
596
|
|
|
597
|
+
### Confluence REST API v1 vs. v2
|
|
598
|
+
|
|
599
|
+
*md2conf* version 0.3.0 has switched to using [Confluence REST API v2](https://developer.atlassian.com/cloud/confluence/rest/v2/) for API calls such as retrieving current page content. Earlier versions used [Confluence REST API v1](https://developer.atlassian.com/cloud/confluence/rest/v1/) exclusively. Unfortunately, Atlassian has decommissioned Confluence REST API v1 for several endpoints in Confluence Cloud as of due date March 31, 2025, and we don't have access to an environment where we could test retired v1 endpoints.
|
|
600
|
+
|
|
601
|
+
If you are restricted to an environment with Confluence REST API v1, we recommend *md2conf* [version 0.2.7](https://pypi.org/project/markdown-to-confluence/0.2.7/). Even though we don't actively support it, we are not aware of any major issues, making it a viable option in an on-premise environment with only Confluence REST API v1 support.
|
|
602
|
+
|
|
586
603
|
### Using the Docker container
|
|
587
604
|
|
|
588
605
|
You can run the Docker container via `docker run` or via `Dockerfile`. Either can accept the environment variables or arguments similar to the Python options. The final argument `./` corresponds to `mdpath` in the command-line utility.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
markdown_to_confluence-0.4.8.dist-info/licenses/LICENSE,sha256=56L-Y0dyZwyVlINRJRz3PNw-ka-oLVaAq-7d8zo6qlc,1077
|
|
2
|
+
md2conf/__init__.py,sha256=TJ8zRe5RlBILNw8pD-Rt3pUrUYCUfh8o4qSdv3ulu2U,402
|
|
3
|
+
md2conf/__main__.py,sha256=pp3Zi60gmhXRqK0uoR4lZMVLlOO8ryAmk8UMPiI-Cew,11527
|
|
4
|
+
md2conf/api.py,sha256=uEPMcR4B-07MMFM96m92z7Znnj7pzhkLLAGcOIseERY,41398
|
|
5
|
+
md2conf/collection.py,sha256=EobgMRJgkYloWlY03NZJ52MRC_SGLpTVCHkltDbQyt0,837
|
|
6
|
+
md2conf/converter.py,sha256=WMtwfnU50-y-LyENbaxKI7Br9gmoLxBCIZIvpeXxli8,69532
|
|
7
|
+
md2conf/csf.py,sha256=rugs3qC2aJQCJSTczeBw9WhqSZZtMq14LjwT0V1b6Hc,6476
|
|
8
|
+
md2conf/domain.py,sha256=rN6QSuoP3JMj-WE8BAggHqHEO8nJbnQDf0b0uhStNZk,2221
|
|
9
|
+
md2conf/drawio.py,sha256=0FoCl0BWxyxO-KLPlDZPyYvSTRpgu9Z6yFKl10TGGMI,8594
|
|
10
|
+
md2conf/emoticon.py,sha256=P2L5oQvnRXeVifJQ3sJ2Ck-6ptbxumq2vsT-rM0W0Ms,484
|
|
11
|
+
md2conf/entities.dtd,sha256=M6NzqL5N7dPs_eUA_6sDsiSLzDaAacrx9LdttiufvYU,30215
|
|
12
|
+
md2conf/environment.py,sha256=RC1jY_TKVbOv2bJxXn27Fj4fNWzyoNUQt6ltgUyVQAQ,3987
|
|
13
|
+
md2conf/extra.py,sha256=VuMxuOnnC2Qwy6y52ukIxsaYhrZArRqMmRHRE4QZl8g,687
|
|
14
|
+
md2conf/latex.py,sha256=i5C_ZqsBG_Df1bNoMJpAKpiYMFcMEn5aoAv6bdSsE1k,7674
|
|
15
|
+
md2conf/local.py,sha256=mvp2kA_eo6JUQ_rlM7zDdEFgBPVxMr3VKP_X1nsLjHE,3747
|
|
16
|
+
md2conf/markdown.py,sha256=czabU17tUfhSX1JQGiI_TrMrTmtoVThOwFu_To_Oi_w,3176
|
|
17
|
+
md2conf/matcher.py,sha256=8g2yiKXfEkYJPIvKD2cswTG9BxFY24BtVcPgKaEVAs8,6812
|
|
18
|
+
md2conf/mermaid.py,sha256=hGrITJVvhHprjQVoezQ1nQeo6a_lqNihF8L-oJ4t5rc,2633
|
|
19
|
+
md2conf/metadata.py,sha256=LzZM-oPNnzCULmLhF516tPlV5zZBknccwMHt8Nan-xg,1007
|
|
20
|
+
md2conf/processor.py,sha256=G1icOxYsPAOjK4fnVdA-vwTsRiZMBpEAmMPOwfOebtQ,9733
|
|
21
|
+
md2conf/publisher.py,sha256=V4TzmrJ5LAv61EPpDYUGWv_6KHb-BcDjtYdByNt6su8,8665
|
|
22
|
+
md2conf/puppeteer-config.json,sha256=-dMTAN_7kNTGbDlfXzApl0KJpAWna9YKZdwMKbpOb60,159
|
|
23
|
+
md2conf/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
24
|
+
md2conf/scanner.py,sha256=O4iOgmSqTe1CYgmdaiF1QyAESzA4SRNEKVY9gOodXDY,7035
|
|
25
|
+
md2conf/text.py,sha256=fHOrUaPXAjE4iRhHqFq-CiI-knpo4wvyHCWp0crewqA,1736
|
|
26
|
+
md2conf/toc.py,sha256=hpqqDbFgNJg5-ul8qWjOglI3Am0sbwR-TLwGN5G9Qo0,2447
|
|
27
|
+
md2conf/uri.py,sha256=KbLBdRFtZTQTZd8b4j0LtE8Pb68Ly0WkemF4iW-EAB4,1158
|
|
28
|
+
md2conf/xml.py,sha256=SpFfcfZm1BPbB4zZM2UC1K-GkzHRhFiotiPMPt5_XPI,5541
|
|
29
|
+
markdown_to_confluence-0.4.8.dist-info/METADATA,sha256=9qSXRbEN4QV6hAhzdIQAW_Bj8iW__Go_vhqBbVFrAJE,36555
|
|
30
|
+
markdown_to_confluence-0.4.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
31
|
+
markdown_to_confluence-0.4.8.dist-info/entry_points.txt,sha256=F1zxa1wtEObtbHS-qp46330WVFLHdMnV2wQ-ZorRmX0,50
|
|
32
|
+
markdown_to_confluence-0.4.8.dist-info/top_level.txt,sha256=_FJfl_kHrHNidyjUOuS01ngu_jDsfc-ZjSocNRJnTzU,8
|
|
33
|
+
markdown_to_confluence-0.4.8.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
34
|
+
markdown_to_confluence-0.4.8.dist-info/RECORD,,
|
md2conf/__init__.py
CHANGED
|
@@ -5,7 +5,7 @@ Parses Markdown files, converts Markdown content into the Confluence Storage For
|
|
|
5
5
|
Confluence API endpoints to upload images and content.
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
|
-
__version__ = "0.4.
|
|
8
|
+
__version__ = "0.4.8"
|
|
9
9
|
__author__ = "Levente Hunyadi"
|
|
10
10
|
__copyright__ = "Copyright 2022-2025, Levente Hunyadi"
|
|
11
11
|
__license__ = "MIT"
|
md2conf/__main__.py
CHANGED
|
@@ -46,6 +46,8 @@ class Arguments(argparse.Namespace):
|
|
|
46
46
|
local: bool
|
|
47
47
|
headers: dict[str, str]
|
|
48
48
|
webui_links: bool
|
|
49
|
+
alignment: Literal["center", "left", "right"]
|
|
50
|
+
use_panel: bool
|
|
49
51
|
|
|
50
52
|
|
|
51
53
|
class KwargsAppendAction(argparse.Action):
|
|
@@ -74,7 +76,7 @@ class PositionalOnlyHelpFormatter(argparse.HelpFormatter):
|
|
|
74
76
|
self,
|
|
75
77
|
usage: Optional[str],
|
|
76
78
|
actions: Iterable[argparse.Action],
|
|
77
|
-
groups: Iterable[argparse._MutuallyExclusiveGroup],
|
|
79
|
+
groups: Iterable[argparse._MutuallyExclusiveGroup], # pyright: ignore[reportPrivateUsage]
|
|
78
80
|
prefix: Optional[str],
|
|
79
81
|
) -> str:
|
|
80
82
|
# filter only positional arguments
|
|
@@ -242,6 +244,19 @@ def get_parser() -> argparse.ArgumentParser:
|
|
|
242
244
|
default=False,
|
|
243
245
|
help="Enable Confluence Web UI links. (Typically required for on-prem versions of Confluence.)",
|
|
244
246
|
)
|
|
247
|
+
parser.add_argument(
|
|
248
|
+
"--alignment",
|
|
249
|
+
dest="alignment",
|
|
250
|
+
choices=["center", "left", "right"],
|
|
251
|
+
default="center",
|
|
252
|
+
help="Alignment for block-level images and formulas (default: 'center').",
|
|
253
|
+
)
|
|
254
|
+
parser.add_argument(
|
|
255
|
+
"--use-panel",
|
|
256
|
+
action="store_true",
|
|
257
|
+
default=False,
|
|
258
|
+
help="Transform admonitions and alerts into a Confluence custom panel.",
|
|
259
|
+
)
|
|
245
260
|
return parser
|
|
246
261
|
|
|
247
262
|
|
|
@@ -275,6 +290,8 @@ def main() -> None:
|
|
|
275
290
|
render_latex=args.render_latex,
|
|
276
291
|
diagram_output_format=args.diagram_output_format,
|
|
277
292
|
webui_links=args.webui_links,
|
|
293
|
+
alignment=args.alignment,
|
|
294
|
+
use_panel=args.use_panel,
|
|
278
295
|
)
|
|
279
296
|
if args.local:
|
|
280
297
|
from .local import LocalConverter
|
md2conf/api.py
CHANGED
|
@@ -17,7 +17,7 @@ import typing
|
|
|
17
17
|
from dataclasses import dataclass
|
|
18
18
|
from pathlib import Path
|
|
19
19
|
from types import TracebackType
|
|
20
|
-
from typing import Any, Optional, TypeVar
|
|
20
|
+
from typing import Any, Optional, TypeVar, overload
|
|
21
21
|
from urllib.parse import urlencode, urlparse, urlunparse
|
|
22
22
|
|
|
23
23
|
import requests
|
|
@@ -71,16 +71,24 @@ def build_url(base_url: str, query: Optional[dict[str, str]] = None) -> str:
|
|
|
71
71
|
LOGGER = logging.getLogger(__name__)
|
|
72
72
|
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
@overload
|
|
75
|
+
def response_cast(response_type: None, response: requests.Response) -> None: ...
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@overload
|
|
79
|
+
def response_cast(response_type: type[T], response: requests.Response) -> T: ...
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def response_cast(response_type: Optional[type[T]], response: requests.Response) -> Optional[T]:
|
|
75
83
|
"Converts a response body into the expected type."
|
|
76
84
|
|
|
77
85
|
if response.text:
|
|
78
86
|
LOGGER.debug("Received HTTP payload:\n%s", response.text)
|
|
79
87
|
response.raise_for_status()
|
|
80
|
-
if response_type is
|
|
81
|
-
return _json_to_object(response_type, response.json())
|
|
82
|
-
else:
|
|
88
|
+
if response_type is None:
|
|
83
89
|
return None
|
|
90
|
+
else:
|
|
91
|
+
return _json_to_object(response_type, response.json())
|
|
84
92
|
|
|
85
93
|
|
|
86
94
|
@enum.unique
|
|
@@ -450,7 +458,7 @@ class ConfluenceSession:
|
|
|
450
458
|
|
|
451
459
|
if not domain or not base_path:
|
|
452
460
|
data = self._get(ConfluenceVersion.VERSION_2, "/spaces", ConfluenceResultSet, query={"limit": "1"})
|
|
453
|
-
base_url = data._links.base
|
|
461
|
+
base_url = data._links.base # pyright: ignore[reportPrivateUsage]
|
|
454
462
|
|
|
455
463
|
_, domain, base_path, _, _, _ = urlparse(base_url)
|
|
456
464
|
if not base_path.endswith("/"):
|
|
@@ -548,23 +556,23 @@ class ConfluenceSession:
|
|
|
548
556
|
|
|
549
557
|
return items
|
|
550
558
|
|
|
551
|
-
def _build_request(self, version: ConfluenceVersion, path: str, body: Any, response_type: type[T]) -> tuple[str, dict[str, str], bytes]:
|
|
559
|
+
def _build_request(self, version: ConfluenceVersion, path: str, body: Any, response_type: Optional[type[T]]) -> tuple[str, dict[str, str], bytes]:
|
|
552
560
|
"Generates URL, headers and raw payload for a typed request/response."
|
|
553
561
|
|
|
554
562
|
url = self._build_url(version, path)
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
"Accept": "application/json",
|
|
559
|
-
}
|
|
560
|
-
else:
|
|
561
|
-
headers = {
|
|
562
|
-
"Content-Type": "application/json; charset=utf-8",
|
|
563
|
-
}
|
|
563
|
+
headers = {"Content-Type": "application/json"}
|
|
564
|
+
if response_type is not None:
|
|
565
|
+
headers["Accept"] = "application/json"
|
|
564
566
|
data = json_dump_string(object_to_json(body)).encode("utf-8")
|
|
565
567
|
return url, headers, data
|
|
566
568
|
|
|
567
|
-
|
|
569
|
+
@overload
|
|
570
|
+
def _post(self, version: ConfluenceVersion, path: str, body: Any, response_type: None) -> None: ...
|
|
571
|
+
|
|
572
|
+
@overload
|
|
573
|
+
def _post(self, version: ConfluenceVersion, path: str, body: Any, response_type: type[T]) -> T: ...
|
|
574
|
+
|
|
575
|
+
def _post(self, version: ConfluenceVersion, path: str, body: Any, response_type: Optional[type[T]]) -> Optional[T]:
|
|
568
576
|
"Creates a new object via Confluence REST API."
|
|
569
577
|
|
|
570
578
|
url, headers, data = self._build_request(version, path, body, response_type)
|
|
@@ -572,7 +580,13 @@ class ConfluenceSession:
|
|
|
572
580
|
response.raise_for_status()
|
|
573
581
|
return response_cast(response_type, response)
|
|
574
582
|
|
|
575
|
-
|
|
583
|
+
@overload
|
|
584
|
+
def _put(self, version: ConfluenceVersion, path: str, body: Any, response_type: None) -> None: ...
|
|
585
|
+
|
|
586
|
+
@overload
|
|
587
|
+
def _put(self, version: ConfluenceVersion, path: str, body: Any, response_type: type[T]) -> T: ...
|
|
588
|
+
|
|
589
|
+
def _put(self, version: ConfluenceVersion, path: str, body: Any, response_type: Optional[type[T]]) -> Optional[T]:
|
|
576
590
|
"Updates an existing object via Confluence REST API."
|
|
577
591
|
|
|
578
592
|
url, headers, data = self._build_request(version, path, body, response_type)
|
|
@@ -806,7 +820,7 @@ class ConfluenceSession:
|
|
|
806
820
|
)
|
|
807
821
|
|
|
808
822
|
LOGGER.info("Updating attachment: %s", attachment_id)
|
|
809
|
-
self._put(ConfluenceVersion.VERSION_1, path, request,
|
|
823
|
+
self._put(ConfluenceVersion.VERSION_1, path, request, None)
|
|
810
824
|
|
|
811
825
|
def get_page_properties_by_title(
|
|
812
826
|
self,
|
|
@@ -899,7 +913,7 @@ class ConfluenceSession:
|
|
|
899
913
|
version=ConfluenceContentVersion(number=version, minorEdit=True),
|
|
900
914
|
)
|
|
901
915
|
LOGGER.info("Updating page: %s", page_id)
|
|
902
|
-
self._put(ConfluenceVersion.VERSION_2, path, request,
|
|
916
|
+
self._put(ConfluenceVersion.VERSION_2, path, request, None)
|
|
903
917
|
|
|
904
918
|
def create_page(
|
|
905
919
|
self,
|
|
@@ -934,7 +948,7 @@ class ConfluenceSession:
|
|
|
934
948
|
url,
|
|
935
949
|
data=json_dump_string(object_to_json(request)).encode("utf-8"),
|
|
936
950
|
headers={
|
|
937
|
-
"Content-Type": "application/json
|
|
951
|
+
"Content-Type": "application/json",
|
|
938
952
|
"Accept": "application/json",
|
|
939
953
|
},
|
|
940
954
|
verify=True,
|
|
@@ -995,7 +1009,7 @@ class ConfluenceSession:
|
|
|
995
1009
|
url,
|
|
996
1010
|
params=query,
|
|
997
1011
|
headers={
|
|
998
|
-
"Content-Type": "application/json
|
|
1012
|
+
"Content-Type": "application/json",
|
|
999
1013
|
"Accept": "application/json",
|
|
1000
1014
|
},
|
|
1001
1015
|
verify=True,
|
|
@@ -1048,7 +1062,7 @@ class ConfluenceSession:
|
|
|
1048
1062
|
"""
|
|
1049
1063
|
|
|
1050
1064
|
path = f"/content/{page_id}/label"
|
|
1051
|
-
self._post(ConfluenceVersion.VERSION_1, path, labels,
|
|
1065
|
+
self._post(ConfluenceVersion.VERSION_1, path, labels, None)
|
|
1052
1066
|
|
|
1053
1067
|
def remove_labels(self, page_id: str, labels: list[ConfluenceLabel]) -> None:
|
|
1054
1068
|
"""
|