Client
CheckedResponse
Bases: NamedTuple
NamedTuple containing page information
Source code in md_to_conf/client.py
14 15 16 17 18 19 20 21 22 23 24 |
|
data: any
instance-attribute
Generic object from JSON response
status_code: int
instance-attribute
Page Id
ConfluenceApiClient
Source code in md_to_conf/client.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
|
__init__(confluence_api_url, username, api_key, space_key, editor_version, use_ssl=True)
Constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
username |
str
|
The Confluence user name associated with the API key |
required |
api_key |
str
|
The API key to access Confluence |
required |
confluence_api_url |
str
|
The URL to the Confluence site |
required |
space_key |
str
|
The Key value for the Space for publishing |
required |
editor_version |
int
|
The editor version for page publishing |
required |
use_ssl |
bool
|
Whether or not to use SSL. |
True
|
Source code in md_to_conf/client.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
add_label(page_id, label_name)
Add the given label to the given page Id
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_id |
int
|
pageId |
required |
label_name |
str
|
label to be added |
required |
Returns: True if successful
Source code in md_to_conf/client.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 |
|
check_errors_and_get_json(response)
Check the response for error codes
Parameters:
Name | Type | Description | Default |
---|---|---|---|
response |
The response from a request |
required |
Source code in md_to_conf/client.py
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
create_page(title, body, parent_id)
Create a new page
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title |
str
|
confluence page title |
required |
body |
str
|
confluence page content |
required |
parent_id |
int
|
confluence parentId |
required |
Returns:
Name | Type | Description |
---|---|---|
PageInfo |
PageInfo
|
A num |
Source code in md_to_conf/client.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
|
delete_page(page_id)
Delete a page
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_id |
int
|
confluence page id |
required |
Source code in md_to_conf/client.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
|
get_attachment(page_id, filename)
Get page attachment
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_id |
int
|
confluence page id |
required |
filename |
str
|
attachment filename |
required |
Returns: The attachment Id, or -1 if not found
Source code in md_to_conf/client.py
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
|
get_label_info(label_name)
Get label information for the given label name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
label_name |
str
|
pageId |
required |
Returns: LabelInfo. If not found, labelInfo will be 0
Source code in md_to_conf/client.py
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 |
|
get_page(title)
Retrieve page details by title
Parameters:
Name | Type | Description | Default |
---|---|---|---|
title |
str
|
page title |
required |
Returns: Confluence page info
Source code in md_to_conf/client.py
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 |
|
get_page_properties(page_id)
Retrieve page properties by page id
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_id |
int
|
pageId |
required |
Returns: Page Properties Collection
Source code in md_to_conf/client.py
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 |
|
get_session(retry=False, json=True)
Retrieve a requests
session object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
retry |
bool
|
Configure the request with a retry adapter. |
False
|
json |
bool
|
Configure the request to set Content-Type to 'application/json' |
True
|
Returns:
requests.Session: A session from the requests
module
Source code in md_to_conf/client.py
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 |
|
get_space_id()
Retrieve the integer space ID for the current self.space_key
Returns:
Type | Description |
---|---|
int
|
The integer ID for the space_key of this instance |
Source code in md_to_conf/client.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
|
log_not_found(object_name, log_values)
Write a "not found" message to the LOGGER
Parameters:
Name | Type | Description | Default |
---|---|---|---|
object_name |
str
|
The name to show in the log message |
required |
log_values |
dict[str, str]
|
Additional key/value pairs to log |
required |
Source code in md_to_conf/client.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
update_labels(page_id, labels)
Update labels on given page Id
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_id |
int
|
pageId |
required |
labels |
List[str]
|
labels to be added |
required |
Returns: True if successful
Source code in md_to_conf/client.py
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 |
|
update_page(page_id, title, body, version, parent_id)
Update a page
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_id |
int
|
confluence page id |
required |
title |
str
|
confluence page title |
required |
body |
str
|
confluence page content |
required |
version |
int
|
confluence page version |
required |
parent_id |
int
|
confluence parentId |
required |
Source code in md_to_conf/client.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
|
update_page_property(page_id, page_property)
Update page property by page id
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_id |
int
|
pageId |
required |
Returns: True if successful
Source code in md_to_conf/client.py
364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
|
upload_attachment(page_id, file, comment)
Upload an attachement
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_id |
int
|
confluence page id |
required |
file |
str
|
attachment file |
required |
comment |
str
|
attachment comment |
required |
Returns: True if successful, false otherwise
Source code in md_to_conf/client.py
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 |
|
LabelInfo
Bases: NamedTuple
NamedTuple containing label information
Source code in md_to_conf/client.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
id: int
instance-attribute
Label Id
label: str
instance-attribute
The translated label
name: str
instance-attribute
The name of the label
prefix: str
instance-attribute
The prefix of the label
PageInfo
Bases: NamedTuple
NamedTuple containing page information
Source code in md_to_conf/client.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
id: int
instance-attribute
Page Id
link: str
instance-attribute
Page Link
spaceId: int
instance-attribute
Space Id
version: int
instance-attribute
Page Version