atlassian-python-api 3.41.13__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.
Files changed (54) hide show
  1. atlassian/VERSION +1 -0
  2. atlassian/__init__.py +32 -0
  3. atlassian/bamboo.py +1343 -0
  4. atlassian/bitbucket/__init__.py +3572 -0
  5. atlassian/bitbucket/base.py +198 -0
  6. atlassian/bitbucket/cloud/__init__.py +24 -0
  7. atlassian/bitbucket/cloud/base.py +123 -0
  8. atlassian/bitbucket/cloud/common/__init__.py +1 -0
  9. atlassian/bitbucket/cloud/common/builds.py +85 -0
  10. atlassian/bitbucket/cloud/common/comments.py +50 -0
  11. atlassian/bitbucket/cloud/common/users.py +79 -0
  12. atlassian/bitbucket/cloud/repositories/__init__.py +437 -0
  13. atlassian/bitbucket/cloud/repositories/branchRestrictions.py +175 -0
  14. atlassian/bitbucket/cloud/repositories/commits.py +188 -0
  15. atlassian/bitbucket/cloud/repositories/defaultReviewers.py +94 -0
  16. atlassian/bitbucket/cloud/repositories/deploymentEnvironments.py +264 -0
  17. atlassian/bitbucket/cloud/repositories/diffstat.py +92 -0
  18. atlassian/bitbucket/cloud/repositories/groupPermissions.py +81 -0
  19. atlassian/bitbucket/cloud/repositories/hooks.py +117 -0
  20. atlassian/bitbucket/cloud/repositories/issues.py +164 -0
  21. atlassian/bitbucket/cloud/repositories/pipelines.py +274 -0
  22. atlassian/bitbucket/cloud/repositories/pullRequests.py +483 -0
  23. atlassian/bitbucket/cloud/repositories/refs.py +136 -0
  24. atlassian/bitbucket/cloud/repositories/repositoryVariables.py +146 -0
  25. atlassian/bitbucket/cloud/workspaces/__init__.py +146 -0
  26. atlassian/bitbucket/cloud/workspaces/members.py +62 -0
  27. atlassian/bitbucket/cloud/workspaces/permissions.py +125 -0
  28. atlassian/bitbucket/cloud/workspaces/projects.py +215 -0
  29. atlassian/bitbucket/server/__init__.py +46 -0
  30. atlassian/bitbucket/server/base.py +63 -0
  31. atlassian/bitbucket/server/common/__init__.py +1 -0
  32. atlassian/bitbucket/server/common/permissions.py +220 -0
  33. atlassian/bitbucket/server/globalPermissions.py +198 -0
  34. atlassian/bitbucket/server/projects/__init__.py +244 -0
  35. atlassian/bitbucket/server/projects/repos/__init__.py +327 -0
  36. atlassian/cloud_admin.py +32 -0
  37. atlassian/confluence.py +3336 -0
  38. atlassian/crowd.py +266 -0
  39. atlassian/errors.py +27 -0
  40. atlassian/insight.py +678 -0
  41. atlassian/jira.py +5324 -0
  42. atlassian/marketplace.py +84 -0
  43. atlassian/portfolio.py +108 -0
  44. atlassian/request_utils.py +39 -0
  45. atlassian/rest_client.py +558 -0
  46. atlassian/service_desk.py +911 -0
  47. atlassian/statuspage.py +3133 -0
  48. atlassian/utils.py +327 -0
  49. atlassian/xray.py +632 -0
  50. atlassian_python_api-3.41.13.dist-info/LICENSE +201 -0
  51. atlassian_python_api-3.41.13.dist-info/METADATA +261 -0
  52. atlassian_python_api-3.41.13.dist-info/RECORD +54 -0
  53. atlassian_python_api-3.41.13.dist-info/WHEEL +5 -0
  54. atlassian_python_api-3.41.13.dist-info/top_level.txt +1 -0
@@ -0,0 +1,3133 @@
1
+ # coding=utf-8
2
+ """Statuspage API wrapper."""
3
+ import logging
4
+ from enum import Enum
5
+
6
+ from .rest_client import AtlassianRestAPI
7
+
8
+ log = logging.getLogger(__name__)
9
+
10
+
11
+ class Branding(Enum):
12
+ """The main template your statuspage will use"""
13
+
14
+ PREMIUM = "premium"
15
+ BASIC = "basic"
16
+
17
+
18
+ class SubscriberType(Enum):
19
+ """The type of subscriber"""
20
+
21
+ EMAIL = "email"
22
+ SMS = "sms"
23
+ WEBHOOK = "webhook"
24
+ SLACK = "slack"
25
+ INTEGRATION_PARTNER = "integration_partner"
26
+
27
+
28
+ class SubscriberState(Enum):
29
+ """The state of the subscriber"""
30
+
31
+ ACTIVE = "active"
32
+ PENDING = "pending"
33
+ QUARANTINED = "quarantined"
34
+ ALL = "all"
35
+
36
+
37
+ class SortField(Enum):
38
+ """The field to sort by
39
+
40
+ Attributes
41
+ ----------
42
+ PRIMARY : str
43
+ to indicate sorting by the identifying field
44
+ CREATED_AT : str
45
+ for sorting by creation timestamp
46
+ QUARANTINED_AT : str
47
+ for sorting by quarantine timestamp
48
+ RELEVANCE : str
49
+ which sorts by the relevancy of the search text
50
+ """
51
+
52
+ PRIMARY = "primary"
53
+ CREATED_AT = "created_at"
54
+ QUARANTINED_AT = "quarantined_at"
55
+ RELEVANCE = "relevance"
56
+
57
+
58
+ class SortOrder(Enum):
59
+ """The order to sort by"""
60
+
61
+ ASC = "asc"
62
+ DESC = "desc"
63
+
64
+
65
+ class Status(Enum):
66
+ """The status of the incident"""
67
+
68
+ INVESTIGATING = "investigating"
69
+ IDENTIFIED = "identified"
70
+ MONITORING = "monitoring"
71
+ RESOLVED = "resolved"
72
+ SCHEDULED = "scheduled"
73
+ IN_PROGRESS = "in_progress"
74
+ VERIFYING = "verifying"
75
+ COMPLETED = "completed"
76
+
77
+
78
+ class Impact(Enum):
79
+ """The impact of the incident"""
80
+
81
+ CRITICAL = "critical"
82
+ MAJOR = "major"
83
+ MINOR = "minor"
84
+ MAINTENANCE = "maintenance"
85
+ NONE = "none"
86
+
87
+
88
+ class Transform(Enum):
89
+ """The transform to apply to the metric"""
90
+
91
+ AVERAGE = "average"
92
+ COUNT = "count"
93
+ MAX = "max"
94
+ MIN = "min"
95
+ SUM = "sum"
96
+
97
+
98
+ class MetricProviderType(Enum):
99
+ """The type of metric provider"""
100
+
101
+ PINGDOM = "Pingdom"
102
+ NEW_RELIC = "NewRelic"
103
+ LIBRATO = "Librato"
104
+ DATADOG = "Datadog"
105
+ SELF = "Self"
106
+
107
+
108
+ class StatusPage(AtlassianRestAPI):
109
+ """StatusPage API wrapper."""
110
+
111
+ def __init__(self, *args, **kwargs):
112
+ super(StatusPage, self).__init__(*args, **kwargs)
113
+
114
+ def page_list_pages(self):
115
+ """
116
+ Get a list of pages
117
+
118
+ Raises
119
+ ------
120
+ requests.exceptions.HTTPError
121
+ Use `json.loads(exception.response.content)` to get API error info
122
+
123
+
124
+ Notes
125
+ -----
126
+ Available fields: https://developer.statuspage.io/#operation/getPages
127
+
128
+ Returns
129
+ -------
130
+ any
131
+ """
132
+ url = "v1/pages"
133
+ return self.get(url)
134
+
135
+ def get_page(self, page_id):
136
+ """
137
+ Get page information
138
+
139
+ Parameters
140
+ ----------
141
+ page_id : str
142
+ Your page unique ID
143
+
144
+ Raises
145
+ ------
146
+ requests.exceptions.HTTPError
147
+ Use `json.loads(exception.response.content)` to get API error info
148
+
149
+ Notes
150
+ -----
151
+ Available fields: https://developer.statuspage.io/#operation/getPagesPageId
152
+
153
+ Returns
154
+ -------
155
+ any
156
+ """
157
+ url = "v1/pages/{}".format(page_id)
158
+ return self.get(url)
159
+
160
+ def page_update(self, page_id, page):
161
+ """
162
+ Update a page
163
+
164
+ Parameters
165
+ ----------
166
+ page_id : str
167
+ Your page unique ID
168
+ page : dict[str,any]
169
+ Your page values that you want to change
170
+
171
+ Raises
172
+ ------
173
+ requests.exceptions.HTTPError
174
+ Use `json.loads(exception.response.content)` to get API error info
175
+
176
+ Notes
177
+ -----
178
+ Available fields: https://developer.statuspage.io/#operation/patchPagesPageId
179
+
180
+ Description of fields:
181
+
182
+ name : str
183
+ The name of your page
184
+
185
+ Returns
186
+ -------
187
+ any
188
+ """
189
+ url = "v1/pages/{}".format(page_id)
190
+ return self.patch(url, data={"page": page})
191
+
192
+ def organization_get_users(self, organization_id, page=1, per_page=100):
193
+ """
194
+ Get a list of users
195
+
196
+ Notes
197
+ -----
198
+ Available fields: https://developer.statuspage.io/#operation/getOrganizationsOrganizationIdUsers
199
+
200
+ Raises
201
+ ------
202
+ requests.exceptions.HTTPError
203
+ Use `json.loads(exception.response.content)` to get API error info
204
+
205
+ Parameters
206
+ ----------
207
+ organization_id : str
208
+ Unique organization ID
209
+ page : int
210
+ Page offset to fetch. Defaults to 1.
211
+ per_page : int
212
+ Number of results to return per page. Defaults to 100.
213
+ Returns
214
+ -------
215
+ any
216
+ """
217
+ url = "v1/organizations/{}/users".format(organization_id)
218
+ return self.get(url, params={"page": page, "per_page": per_page})
219
+
220
+ def organization_get_user_permissions(self, organization_id, user_id):
221
+ """
222
+ Get a user's permissions in organization
223
+
224
+ Parameters
225
+ ----------
226
+ organization_id : str
227
+ Unique organization ID
228
+ user_id : str
229
+ Unique user ID
230
+
231
+ Notes
232
+ -----
233
+ Available fields: https://developer.statuspage.io/#operation/getOrganizationsOrganizationIdPermissionsUserId
234
+
235
+ Raises
236
+ ------
237
+ requests.exceptions.HTTPError
238
+ Use `json.loads(exception.response.content)` to get API error info
239
+
240
+ Returns
241
+ -------
242
+ any
243
+ """
244
+ url = "v1/organizations/{}/permissions/{}".format(organization_id, user_id)
245
+ return self.get(url)
246
+
247
+ def organization_set_user_permissions(self, organization_id, user_id, pages):
248
+ """
249
+ Update a user's role permissions. Payload should contain a mapping of pages to a set of the desired roles,
250
+ if the page has Role Based Access Control. Otherwise, the pages should map to an empty hash.
251
+ User will lose access to any pages omitted from the payload.
252
+
253
+ Parameters
254
+ ----------
255
+ organization_id : str
256
+ Unique organization ID
257
+ user_id : str
258
+ Unique user ID
259
+ pages : dict[str, any]
260
+ You can specify "page_configuration", "incident_manager" and "maintenance_manager" booleans here
261
+
262
+ Notes
263
+ -----
264
+ Available fields: https://developer.statuspage.io/#operation/putOrganizationsOrganizationIdPermissionsUserId
265
+
266
+ Raises
267
+ ------
268
+ requests.exceptions.HTTPError
269
+ Use `json.loads(exception.response.content)` to get API error info
270
+
271
+ Examples
272
+ --------
273
+ >>> client = StatusPage(url="https://api.statuspage.io", token="YOUR-TOKEN")
274
+ >>> client.organization_set_user_permissions(
275
+ ... "ORGANIZATION-ID",
276
+ ... "USER-ID",
277
+ ... {
278
+ ... "PAGE-ID": {
279
+ ... "page_configuration": True,
280
+ ... "incident_manager": True,
281
+ ... "maintenance_manager": True
282
+ ... }
283
+ ... }
284
+ ... )
285
+
286
+ Returns
287
+ -------
288
+ any
289
+ """
290
+ url = "v1/organizations/{}/permissions/{}".format(organization_id, user_id)
291
+ return self.patch(url, data={"pages": pages})
292
+
293
+ def page_get_embed_config_settings(self, page_id):
294
+ """
295
+ Get status embed config settings
296
+
297
+ Parameters
298
+ ----------
299
+ page_id : str
300
+ Your page unique ID
301
+
302
+ Raises
303
+ ------
304
+ requests.exceptions.HTTPError
305
+ Use `json.loads(exception.response.content)` to get API error info
306
+
307
+ Notes
308
+ -----
309
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdStatusEmbedConfig
310
+
311
+ Returns
312
+ -------
313
+ any
314
+ """
315
+ url = "v1/pages/{}/status_embed_config".format(page_id)
316
+ return self.get(url)
317
+
318
+ def page_update_embed_config_settings(self, page_id, status_embed_config):
319
+ """
320
+ Update status embed config settings
321
+
322
+ Parameters
323
+ ----------
324
+ page_id : str
325
+ Your page unique ID
326
+ status_embed_config : dict[str, any]
327
+
328
+ Raises
329
+ ------
330
+ requests.exceptions.HTTPError
331
+ Use `json.loads(exceptions.response.content)` to get API error info
332
+
333
+ Examples
334
+ --------
335
+ >>> client = StatusPage(url="https://api.statuspage.io", token="YOUR-TOKEN")
336
+ >>> client.page_update_embed_config_settings(
337
+ ... "PAGE-ID",
338
+ ... {
339
+ ... "position": "string",
340
+ ... "incident_background_color": "string",
341
+ ... "incident_text_color": "string",
342
+ ... "maintenance_background_color": "string",
343
+ ... "maintenance_text_color": "string"
344
+ ... }
345
+ ... )
346
+
347
+ Notes
348
+ -----
349
+ See available fields: https://developer.statuspage.io/#operation/putPagesPageIdStatusEmbedConfig
350
+
351
+ Returns
352
+ -------
353
+ any
354
+ """
355
+ url = "v1/pages/{}/status_embed_config".format(page_id)
356
+ return self.patch(url, status_embed_config)
357
+
358
+ def page_access_users_list(self, page_id, email, page=1, per_page=100):
359
+ """
360
+ Get a list of page access users
361
+
362
+ Parameters
363
+ ----------
364
+ page_id : str
365
+ Your page unique ID
366
+ email : str
367
+ Email address to search for
368
+ page : int
369
+ Page offset to fetch. Defaults to 1.
370
+ per_page : int
371
+ Number of results to return per page. Defaults to 100.
372
+
373
+ Notes
374
+ -----
375
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdPageAccessUsers
376
+
377
+ Raises
378
+ ------
379
+ requests.exceptions.HTTPError
380
+ Use `json.loads(exceptions.response.content)` to get API error info
381
+
382
+ Returns
383
+ -------
384
+ any
385
+ """
386
+ url = "v1/pages/{}/page_access_users".format(page_id)
387
+ return self.get(url, params={"email": email, "page": page, "per_page": per_page})
388
+
389
+ def page_get_access_user(self, page_id, page_access_user_id):
390
+ """
391
+ Get page access user
392
+
393
+ Parameters
394
+ ----------
395
+ page_id : str
396
+ Your page unique ID
397
+ page_access_user_id : str
398
+ Page Access User Identifier
399
+
400
+ Notes
401
+ -----
402
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdPageAccessUsersPageAccessUserId
403
+
404
+ Raises
405
+ ------
406
+ requests.exceptions.HTTPError
407
+ Use `json.loads(exceptions.response.content)` to get API error info
408
+
409
+ Returns
410
+ -------
411
+ any
412
+ """
413
+ url = "v1/pages/{}/page_access_users/{}".format(page_id, page_access_user_id)
414
+ return self.get(url)
415
+
416
+ def page_set_access_user(self, page_id, page_access_user_id, external_login, email, page_access_group_ids):
417
+ """
418
+ Update page access user
419
+
420
+ Warnings
421
+ --------
422
+ TODO: Fields that can be updated are undocumented as well as their descriptions.
423
+
424
+ Parameters
425
+ ----------
426
+ page_id : str
427
+ Your page unique ID
428
+ page_access_user_id : str
429
+ Page Access User Identifier
430
+ external_login : str
431
+ IDP login user id. Key is typically "uid".
432
+ email : str
433
+ Email address
434
+ page_access_group_ids : list[str]
435
+ Group IDs
436
+
437
+ Notes
438
+ -----
439
+ See available fields: https://developer.statuspage.io/#operation/patchPagesPageIdPageAccessUsersPageAccessUserId
440
+
441
+ Raises
442
+ ------
443
+ requests.exceptions.HTTPError
444
+ Use `json.loads(exceptions.response.content)` to get API error info
445
+
446
+ Returns
447
+ -------
448
+ any
449
+ """
450
+ url = "v1/pages/{}/page_access_users/{}".format(page_id, page_access_user_id)
451
+ return self.patch(
452
+ url, data={"external_login": external_login, "email": email, "page_access_group_ids": page_access_group_ids}
453
+ )
454
+
455
+ def page_delete_access_user(self, page_id, page_access_user_id):
456
+ """
457
+ Delete page access user
458
+
459
+ Parameters
460
+ ----------
461
+ page_id : str
462
+ Your page unique ID
463
+ page_access_user_id : str
464
+ Page Access User Identifier
465
+
466
+ Notes
467
+ -----
468
+ See available fields:
469
+ https://developer.statuspage.io/#operation/deletePagesPageIdPageAccessUsersPageAccessUserId
470
+
471
+ Raises
472
+ ------
473
+ requests.exceptions.HTTPError
474
+ Use `json.loads(exceptions.response.content)` to get API error info
475
+
476
+ Returns
477
+ -------
478
+ any
479
+ """
480
+ url = "v1/pages/{}/page_access_users/{}".format(page_id, page_access_user_id)
481
+ return self.delete(url)
482
+
483
+ def page_get_components_access_user(self, page_id, page_access_user_id, page=1, per_page=100):
484
+ """
485
+ Get components for page access user
486
+
487
+ Parameters
488
+ ----------
489
+ page_id : str
490
+ Your page unique ID
491
+ page_access_user_id : str
492
+ Page Access User Identifier
493
+ page : int
494
+ Page offset to fetch. Defaults to 1.
495
+ per_page : int
496
+ Number of results to return per page. Defaults to 100.
497
+
498
+ Notes
499
+ -----
500
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdPageAccessUsersPageAccessUserIdComponents
501
+ # noqa: E501
502
+
503
+ Raises
504
+ ------
505
+ requests.exceptions.HTTPError
506
+ Use `json.loads(exceptions.response.content)` to get API error info
507
+
508
+ Returns
509
+ -------
510
+ any
511
+ """
512
+ url = "v1/pages/{}/page_access_users/{}/components".format(page_id, page_access_user_id)
513
+ return self.get(url, params={"page": page, "per_page": per_page})
514
+
515
+ def page_add_components_access_user(self, page_id, page_access_user_id, component_ids):
516
+ """
517
+ Add components for page access user
518
+
519
+ Parameters
520
+ ----------
521
+ page_id : str
522
+ Your page unique ID
523
+ page_access_user_id : str
524
+ Page Access User Identifier
525
+ component_ids : list[str]
526
+ List of component codes to allow access to
527
+
528
+ Notes
529
+ -----
530
+ See available fields: https://developer.statuspage.io/#operation/putPagesPageIdPageAccessUsersPageAccessUserIdComponents
531
+ # noqa: E501
532
+
533
+ Raises
534
+ ------
535
+ requests.exceptions.HTTPError
536
+ Use `json.loads(exceptions.response.content)` to get API error info
537
+
538
+ Returns
539
+ -------
540
+ any
541
+ """
542
+ url = "v1/pages/{}/page_access_users/{}/components".format(page_id, page_access_user_id)
543
+ return self.patch(url, data={"component_ids": component_ids})
544
+
545
+ def page_replace_components_access_user(self, page_id, page_access_user_id, component_ids):
546
+ """
547
+ Replace components for page access user
548
+
549
+ Parameters
550
+ ----------
551
+ page_id : str
552
+ Your page unique ID
553
+ page_access_user_id : str
554
+ Page Access User Identifier
555
+ component_ids : list[str]
556
+ List of component codes to allow access to
557
+
558
+ Notes
559
+ -----
560
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdPageAccessUsersPageAccessUserIdComponents
561
+ # noqa: E501
562
+
563
+ Raises
564
+ ------
565
+ requests.exceptions.HTTPError
566
+ Use `json.loads(exceptions.response.content)` to get API error info
567
+
568
+ Returns
569
+ -------
570
+ any
571
+ """
572
+ url = "v1/pages/{}/page_access_users/{}/components".format(page_id, page_access_user_id)
573
+ return self.post(url, data={"component_ids": component_ids})
574
+
575
+ def page_delete_components_access_user(self, page_id, page_access_user_id, component_ids):
576
+ """
577
+ Delete components for page access user.
578
+
579
+ Parameters
580
+ ----------
581
+ page_id : str
582
+ Your page unique ID
583
+ page_access_user_id : str
584
+ Page Access User Identifier
585
+ component_ids : list[str]
586
+ List of components codes to remove. **If omitted, all components will be removed.**
587
+
588
+ Notes
589
+ -----
590
+ See available fields: https://developer.statuspage.io/#operation/deletePagesPageIdPageAccessUsersPageAccessUserIdComponents
591
+ # noqa: E501
592
+
593
+ Raises
594
+ ------
595
+ requests.exceptions.HTTPError
596
+ Use `json.loads(exceptions.response.content)` to get API error info
597
+
598
+ Returns
599
+ -------
600
+ any
601
+ """
602
+ url = "v1/pages/{}/page_access_users/{}/components".format(page_id, page_access_user_id)
603
+ return self.delete(url, data={"component_ids": component_ids})
604
+
605
+ def page_delete_component_access_user(self, page_id, page_access_user_id, component_id):
606
+ """
607
+ Delete components for page access user.
608
+
609
+ Parameters
610
+ ----------
611
+ page_id : str
612
+ Your page unique ID
613
+ page_access_user_id : str
614
+ Page Access User Identifier
615
+ component_id : str
616
+ Component identifier
617
+
618
+ Notes
619
+ -----
620
+ See available fields: https://developer.statuspage.io/#operation/deletePagesPageIdPageAccessUsersPageAccessUserIdComponentsComponentId
621
+ # noqa: E501
622
+
623
+ Raises
624
+ ------
625
+ requests.exceptions.HTTPError
626
+ Use `json.loads(exceptions.response.content)` to get API error info
627
+
628
+ Returns
629
+ -------
630
+ any
631
+ """
632
+ url = "v1/pages/{}/page_access_users/{}/components/{}".format(page_id, page_access_user_id, component_id)
633
+ return self.delete(url)
634
+
635
+ def page_get_metrics_access_user(self, page_id, page_access_user_id):
636
+ """
637
+ Get metrics for page access user
638
+
639
+ Parameters
640
+ ----------
641
+ page_id : str
642
+ Your page unique ID
643
+ page_access_user_id : str
644
+ Page Access User Identifier
645
+
646
+ Notes
647
+ -----
648
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdPageAccessUsersPageAccessUserIdMetrics
649
+ # noqa: E501
650
+
651
+ Raises
652
+ ------
653
+ requests.exceptions.HTTPError
654
+ Use `json.loads(exceptions.response.content)` to get API error info
655
+
656
+ Returns
657
+ -------
658
+ any
659
+ """
660
+ url = "v1/pages/{}/page_access_users/{}/metrics".format(page_id, page_access_user_id)
661
+ return self.get(url)
662
+
663
+ def page_add_metrics_access_user(self, page_id, page_access_user_id, metric_ids):
664
+ """
665
+ Add metrics for page access user
666
+
667
+ Parameters
668
+ ----------
669
+ page_id : str
670
+ Your page unique ID
671
+ page_access_user_id : str
672
+ Page Access User Identifier
673
+ metric_ids : list[str]
674
+ List of metrics to add
675
+
676
+ Notes
677
+ -----
678
+ See available fields: https://developer.statuspage.io/#operation/putPagesPageIdPageAccessUsersPageAccessUserIdMetrics
679
+ # noqa: E501
680
+
681
+ Raises
682
+ ------
683
+ requests.exceptions.HTTPError
684
+ Use `json.loads(exceptions.response.content)` to get API error info
685
+
686
+ Returns
687
+ -------
688
+ any
689
+ """
690
+ url = "v1/pages/{}/page_access_users/{}/metrics".format(page_id, page_access_user_id)
691
+ return self.patch(url, data={"metric_ids": metric_ids})
692
+
693
+ def page_replace_metrics_access_user(self, page_id, page_access_user_id, metric_ids):
694
+ """
695
+ Replace metrics for page access user
696
+
697
+ Parameters
698
+ ----------
699
+ page_id : str
700
+ Your page unique ID
701
+ page_access_user_id : str
702
+ Page Access User Identifier
703
+ metric_ids : list[str]
704
+ List of metrics to replace
705
+
706
+ Notes
707
+ -----
708
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdPageAccessUsersPageAccessUserIdMetrics
709
+ # noqa: E501
710
+
711
+ Raises
712
+ ------
713
+ requests.exceptions.HTTPError
714
+ Use `json.loads(exceptions.response.content)` to get API error info
715
+
716
+ Returns
717
+ -------
718
+ any
719
+ """
720
+ url = "v1/pages/{}/page_access_users/{}/metrics".format(page_id, page_access_user_id)
721
+ return self.post(url, data={"metric_ids": metric_ids})
722
+
723
+ def page_delete_metrics_access_user(self, page_id, page_access_user_id, metric_ids):
724
+ """
725
+ Delete metrics for page access user
726
+
727
+ Parameters
728
+ ----------
729
+ page_id : str
730
+ Your page unique ID
731
+ page_access_user_id : str
732
+ Page Access User Identifier
733
+ metric_ids : list[str]
734
+ List of metrics to remove
735
+
736
+ Notes
737
+ -----
738
+ See available fields: https://developer.statuspage.io/#operation/deletePagesPageIdPageAccessUsersPageAccessUserIdMetrics
739
+ # noqa: E501
740
+
741
+ Raises
742
+ ------
743
+ requests.exceptions.HTTPError
744
+ Use `json.loads(exceptions.response.content)` to get API error info
745
+
746
+ Returns
747
+ -------
748
+ any
749
+ """
750
+ url = "v1/pages/{}/page_access_users/{}/metrics".format(page_id, page_access_user_id)
751
+ return self.delete(url, data={"metric_ids": metric_ids})
752
+
753
+ def page_delete_metric_access_user(self, page_id, page_access_user_id, metric_id):
754
+ """
755
+ Delete metric for page access user
756
+
757
+ Parameters
758
+ ----------
759
+ page_id : str
760
+ Your page unique ID
761
+ page_access_user_id : str
762
+ Page Access User Identifier
763
+ metric_id : str
764
+ Identifier of metric requested
765
+
766
+ Notes
767
+ -----
768
+ See available fields: https://developer.statuspage.io/#operation/deletePagesPageIdPageAccessUsersPageAccessUserIdMetricsMetricId
769
+ # noqa: E501
770
+
771
+ Raises
772
+ ------
773
+ requests.exceptions.HTTPError
774
+ Use `json.loads(exceptions.response.content)` to get API error info
775
+
776
+ Returns
777
+ -------
778
+ any
779
+ """
780
+ url = "v1/pages/{}/page_access_users/{}/metrics/{}".format(page_id, page_access_user_id, metric_id)
781
+ return self.delete(url)
782
+
783
+ def page_get_access_groups(self, page_id, page=1, per_page=100):
784
+ """
785
+ Get a list of page access groups
786
+
787
+ Parameters
788
+ ----------
789
+ page_id : str
790
+ Your page unique ID
791
+ page : int
792
+ Page offset to fetch. Defaults to 1.
793
+ per_page : int
794
+ Number of results to return per page. Defaults to 100.
795
+
796
+ Notes
797
+ -----
798
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdPageAccessGroups
799
+
800
+ Raises
801
+ ------
802
+ requests.exceptions.HTTPError
803
+ Use `json.loads(exceptions.response.content)` to get API error info
804
+
805
+ Returns
806
+ -------
807
+ any
808
+ """
809
+ url = "v1/pages/{}/page_access_groups".format(page_id)
810
+ return self.get(url, params={"page": page, "per_page": per_page})
811
+
812
+ def page_get_access_group(self, page_id, page_access_group_id):
813
+ """
814
+ Get a page access group
815
+
816
+ Parameters
817
+ ----------
818
+ page_id : str
819
+ Your page unique ID
820
+ page_access_group_id : str
821
+ Page Access Group Identifier
822
+
823
+ Notes
824
+ -----
825
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdPageAccessGroupsPageAccessGroupId
826
+
827
+ Raises
828
+ ------
829
+ requests.exceptions.HTTPError
830
+ Use `json.loads(exceptions.response.content)` to get API error info
831
+
832
+ Returns
833
+ -------
834
+ any
835
+ """
836
+ url = "v1/pages/{}/page_access_groups/{}".format(page_id, page_access_group_id)
837
+ return self.get(url)
838
+
839
+ def page_create_access_group(
840
+ self, page_id, name, external_identifier, component_ids, metric_ids, page_access_user_ids
841
+ ):
842
+ """
843
+ Create a page access group
844
+
845
+ Parameters
846
+ ----------
847
+ page_id : str
848
+ Your page unique ID
849
+ name : str
850
+ Name for this Group
851
+ external_identifier : str
852
+ Associates group with external group
853
+ component_ids : list[str]
854
+ metric_ids : list[str]
855
+ page_access_user_ids : list[str]
856
+
857
+ Notes
858
+ -----
859
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdPageAccessGroups
860
+
861
+ Raises
862
+ ------
863
+ requests.exceptions.HTTPError
864
+ Use `json.loads(exceptions.response.content)` to get API error info
865
+
866
+ Returns
867
+ -------
868
+ any
869
+ """
870
+ url = "v1/pages/{}/page_access_groups".format(page_id)
871
+ return self.post(
872
+ url,
873
+ data={
874
+ "page_access_group": {
875
+ "name": name,
876
+ "external_identifier": external_identifier,
877
+ "component_ids": component_ids,
878
+ "metric_ids": metric_ids,
879
+ "page_access_user_ids": page_access_user_ids,
880
+ }
881
+ },
882
+ )
883
+
884
+ def page_replace_access_group(
885
+ self, page_id, page_access_group_id, name, external_identifier, component_ids, metric_ids, page_access_user_ids
886
+ ):
887
+ """
888
+ Update a page access group
889
+
890
+ Parameters
891
+ ----------
892
+ page_id : str
893
+ Your page unique ID
894
+ page_access_group_id : str
895
+ Page Access Group Identifier
896
+ name : str
897
+ Name for this Group
898
+ external_identifier : str
899
+ Associates group with external group
900
+ component_ids : list[str]
901
+ metric_ids : list[str]
902
+ page_access_user_ids : list[str]
903
+
904
+ Notes
905
+ -----
906
+ See available fields: https://developer.statuspage.io/#operation/putPagesPageIdPageAccessGroupsPageAccessGroupId
907
+
908
+ Raises
909
+ ------
910
+ requests.exceptions.HTTPError
911
+ Use `json.loads(exceptions.response.content)` to get API error info
912
+
913
+ Returns
914
+ -------
915
+ any
916
+ """
917
+ url = "v1/pages/{}/page_access_groups/{}".format(page_id, page_access_group_id)
918
+ return self.patch(
919
+ url,
920
+ data={
921
+ "page_access_group": {
922
+ "name": name,
923
+ "external_identifier": external_identifier,
924
+ "component_ids": component_ids,
925
+ "metric_ids": metric_ids,
926
+ "page_access_user_ids": page_access_user_ids,
927
+ }
928
+ },
929
+ )
930
+
931
+ def page_delete_access_group(self, page_id, page_access_group_id):
932
+ """
933
+ Remove a page access group
934
+
935
+ Parameters
936
+ ----------
937
+ page_id : str
938
+ Your page unique ID
939
+ page_access_group_id : str
940
+ Page Access Group Identifier
941
+
942
+ Notes
943
+ -----
944
+ See available fields: https://developer.statuspage.io/#operation/deletePagesPageIdPageAccessGroupsPageAccessGroupId
945
+ # noqa: E501
946
+
947
+ Raises
948
+ ------
949
+ requests.exceptions.HTTPError
950
+ Use `json.loads(exceptions.response.content)` to get API error info
951
+
952
+ Returns
953
+ -------
954
+ any
955
+ """
956
+ url = "v1/pages/{}/page_access_groups/{}".format(page_id, page_access_group_id)
957
+ return self.delete(url)
958
+
959
+ def page_add_components_to_access_group(self, page_id, page_access_group_id, component_ids):
960
+ """
961
+ Add components to page access group
962
+
963
+ Parameters
964
+ ----------
965
+ page_id : str
966
+ Your page unique ID
967
+ page_access_group_id : str
968
+ Page Access Group Identifier
969
+ component_ids : list[str]
970
+ List of Component identifiers
971
+
972
+ Notes
973
+ -----
974
+ See available fields: https://developer.statuspage.io/#tag/page-access-group-components
975
+
976
+ Raises
977
+ ------
978
+ requests.exceptions.HTTPError
979
+ Use `json.loads(exceptions.response.content)` to get API error info
980
+
981
+ Returns
982
+ -------
983
+ any
984
+ """
985
+ url = "v1/pages/{}/page_access_groups/{}/components".format(page_id, page_access_group_id)
986
+ return self.patch(url, data={"component_ids": component_ids})
987
+
988
+ def page_replace_components_for_access_page(self, page_id, page_access_group_id, component_ids):
989
+ """
990
+ Replace components for a page access group
991
+
992
+ Parameters
993
+ ----------
994
+ page_id : str
995
+ Your page unique ID
996
+ page_access_group_id : str
997
+ Page Access Group Identifier
998
+ component_ids : list[str]
999
+ List of components codes to set on the page access group
1000
+
1001
+ Notes
1002
+ -----
1003
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdPageAccessGroupsPageAccessGroupIdComponents
1004
+ # noqa: E501
1005
+
1006
+ Raises
1007
+ ------
1008
+ requests.exceptions.HTTPError
1009
+ Use `json.loads(exceptions.response.content)` to get API error info
1010
+
1011
+ Returns
1012
+ -------
1013
+ any
1014
+ """
1015
+ url = "v1/pages/{}/page_access_groups/{}/components".format(page_id, page_access_group_id)
1016
+ return self.post(url, data={"component_ids": component_ids})
1017
+
1018
+ def page_delete_components_for_access_page(self, page_id, page_access_group_id, component_ids):
1019
+ """
1020
+ Delete components for a page access group
1021
+
1022
+ Parameters
1023
+ ----------
1024
+ page_id : str
1025
+ Your page unique ID
1026
+ page_access_group_id : str
1027
+ Page Access Group Identifier
1028
+ component_ids : list[str]
1029
+ List of Component identifiers
1030
+
1031
+ Notes
1032
+ -----
1033
+ See available fields: https://developer.statuspage.io/#operation/deletePagesPageIdPageAccessGroupsPageAccessGroupIdComponents
1034
+ # noqa: E501
1035
+
1036
+ Raises
1037
+ ------
1038
+ requests.exceptions.HTTPError
1039
+ Use `json.loads(exceptions.response.content)` to get API error info
1040
+
1041
+ Returns
1042
+ -------
1043
+ any
1044
+ """
1045
+ url = "v1/pages/{}/page_access_groups/{}/components".format(page_id, page_access_group_id)
1046
+ return self.delete(url, data={"component_ids": component_ids})
1047
+
1048
+ def page_delete_component_for_access_page(self, page_id, page_access_group_id, component_id):
1049
+ """
1050
+ Remove a component from a page access group
1051
+
1052
+ Parameters
1053
+ ----------
1054
+ page_id : str
1055
+ Your page unique ID
1056
+ page_access_group_id : str
1057
+ Page Access Group Identifier
1058
+ component_id : str
1059
+ Component identifier
1060
+
1061
+ Notes
1062
+ -----
1063
+ See available fields: https://developer.statuspage.io/#operation/deletePagesPageIdPageAccessGroupsPageAccessGroupIdComponentsComponentId
1064
+ # noqa: E501
1065
+
1066
+ Raises
1067
+ ------
1068
+ requests.exceptions.HTTPError
1069
+ Use `json.loads(exceptions.response.content)` to get API error info
1070
+
1071
+ Returns
1072
+ -------
1073
+ any
1074
+ """
1075
+ url = "v1/pages/{}/page_access_groups/{}/components/{}".format(page_id, page_access_group_id, component_id)
1076
+ return self.delete(url)
1077
+
1078
+ def page_get_components_for_access_group(self, page_id, page_access_group_id, page=1, per_page=100):
1079
+ """
1080
+ Add components to page access group
1081
+
1082
+ Parameters
1083
+ ----------
1084
+ page_id : str
1085
+ Your page unique ID
1086
+ page_access_group_id : str
1087
+ Page Access Group Identifier
1088
+ page : int
1089
+ Page offset to fetch. Defaults to 1.
1090
+ per_page : int
1091
+ Number of results to return per page. Defaults to 100.
1092
+
1093
+ Notes
1094
+ -----
1095
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdPageAccessGroupsPageAccessGroupIdComponents
1096
+ # noqa: E501
1097
+
1098
+ Raises
1099
+ ------
1100
+ requests.exceptions.HTTPError
1101
+ Use `json.loads(exceptions.response.content)` to get API error info
1102
+
1103
+ Returns
1104
+ -------
1105
+ any
1106
+ """
1107
+ url = "v1/pages/{}/page_access_groups/{}/components".format(page_id, page_access_group_id)
1108
+ return self.get(url, params={"page": page, "per_page": per_page})
1109
+
1110
+ def page_get_subscriber(self, page_id, subscriber_id):
1111
+ """
1112
+ Get a subscriber
1113
+
1114
+ Parameters
1115
+ ----------
1116
+ page_id : str
1117
+ Your page unique ID
1118
+ subscriber_id : str
1119
+ Subscriber identifier
1120
+
1121
+ Notes
1122
+ -----
1123
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdSubscribersSubscriberId
1124
+
1125
+ Raises
1126
+ ------
1127
+ requests.exceptions.HTTPError
1128
+ Use `json.loads(exceptions.response.content)` to get API error info
1129
+
1130
+ Returns
1131
+ -------
1132
+ any
1133
+ """
1134
+ url = "v1/pages/{}/subscribers/{}".format(page_id, subscriber_id)
1135
+ return self.get(url)
1136
+
1137
+ def page_get_subscribers(self, page_id, search_by=None, sort_direction="asc", page=1, per_page=100):
1138
+ """
1139
+ Get all subscribers
1140
+
1141
+ Parameters
1142
+ ----------
1143
+ page_id : str
1144
+ Your page unique ID
1145
+ page : int
1146
+ Page offset to fetch. Defaults to 1.
1147
+ per_page : int
1148
+ Number of results to return per page. Defaults to 100.
1149
+ search_by : dict[str, any]
1150
+ What to search by.
1151
+
1152
+ "q" : str
1153
+ If this is specified, search the contact information (email, endpoint, or phone number)
1154
+ for the provided value. This parameter doesn't support searching for Slack subscribers.
1155
+
1156
+ "subscriber_type" : SubscriberType
1157
+ If this is specified, only return subscribers of the specified type.
1158
+
1159
+ "subscriber_state" : SubscriberState
1160
+ If this is specified, only return subscribers of the specified state.
1161
+ Specify state "all" to find subscribers in any states.
1162
+
1163
+ "sort_field" : SortField
1164
+ The field on which to sort the results.
1165
+
1166
+ sort_direction : SortOrder
1167
+ The direction in which to sort the results.
1168
+
1169
+ Notes
1170
+ -----
1171
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdSubscribers
1172
+
1173
+ Raises
1174
+ ------
1175
+ requests.exceptions.HTTPError
1176
+ Use `json.loads(exceptions.response.content)` to get API error info
1177
+
1178
+ Returns
1179
+ -------
1180
+ any
1181
+ """
1182
+ url = "v1/pages/{}/subscribers".format(page_id)
1183
+
1184
+ params = {}
1185
+
1186
+ if search_by:
1187
+ if "q" in search_by:
1188
+ params["q"] = search_by["q"]
1189
+ if "subscriber_type" in search_by:
1190
+ params["type"] = search_by["subscriber_type"]
1191
+ if "subscriber_state" in search_by:
1192
+ params["state"] = search_by["subscriber_state"]
1193
+ if "sort_field" in search_by:
1194
+ params["sort_field"] = search_by["sort_field"]
1195
+
1196
+ params["sort_direction"] = sort_direction
1197
+ params["page"] = page
1198
+ params["per_page"] = per_page
1199
+
1200
+ return self.get(url, params=params)
1201
+
1202
+ def page_update_subscriber(self, page_id, subscriber_id, component_ids):
1203
+ """
1204
+ Update a subscriber
1205
+
1206
+ Parameters
1207
+ ----------
1208
+ page_id : str
1209
+ Your page unique ID
1210
+ subscriber_id : str
1211
+ Subscriber identifier
1212
+ component_ids : list[str]
1213
+ A list of component ids for which the subscriber should receive updates for.
1214
+ Components must be an array with at least one element if it is passed at all.
1215
+ Each component must belong to the page indicated in the path.
1216
+ To set the subscriber to be subscribed to all components on the page, exclude this parameter.
1217
+
1218
+ Notes
1219
+ -----
1220
+ See available fields: https://developer.statuspage.io/#operation/patchPagesPageIdSubscribersSubscriberId
1221
+
1222
+ Raises
1223
+ ------
1224
+ requests.exceptions.HTTPError
1225
+ Use `json.loads(exceptions.response.content)` to get API error info
1226
+
1227
+ Returns
1228
+ -------
1229
+ any
1230
+ """
1231
+ url = "v1/pages/{}/subscribers/{}".format(page_id, subscriber_id)
1232
+ return self.patch(url, data={"component_ids": component_ids})
1233
+
1234
+ def page_unsubscribe_subscriber(self, page_id, subscriber_id, skip_unsubscription_notifications=False):
1235
+ """
1236
+ Unsubscribe a subscriber
1237
+
1238
+ Parameters
1239
+ ----------
1240
+ page_id : str
1241
+ Your page unique ID
1242
+ subscriber_id : str
1243
+ Subscriber identifier
1244
+ skip_unsubscription_notifications : bool
1245
+ If true, the subscriber will not receive an email notification when they are unsubscribed.
1246
+
1247
+ Notes
1248
+ -----
1249
+ See available fields: https://developer.statuspage.io/#operation/deletePagesPageIdSubscribersSubscriberId
1250
+
1251
+ Raises
1252
+ ------
1253
+ requests.exceptions.HTTPError
1254
+ Use `json.loads(exceptions.response.content)` to get API error info
1255
+
1256
+ Returns
1257
+ -------
1258
+ any
1259
+ """
1260
+ url = "v1/pages/{}/subscribers/{}".format(page_id, subscriber_id)
1261
+ return self.delete(url, params={"skip_unsubscription_notifications": skip_unsubscription_notifications})
1262
+
1263
+ def page_resend_confirmation_subscribers(self, page_id, subscriber_id):
1264
+ """
1265
+ Resend confirmation email to a subscriber
1266
+
1267
+ Parameters
1268
+ ----------
1269
+ page_id : str
1270
+ Your page unique ID
1271
+ subscriber_id : str
1272
+ Subscriber identifier
1273
+
1274
+ Notes
1275
+ -----
1276
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdSubscribersSubscriberIdResendConfirmation
1277
+ # noqa: E501
1278
+
1279
+ Raises
1280
+ ------
1281
+ requests.exceptions.HTTPError
1282
+ Use `json.loads(exceptions.response.content)` to get API error info
1283
+
1284
+ Returns
1285
+ -------
1286
+ any
1287
+ """
1288
+ url = "v1/pages/{}/subscribers/{}/resend_confirmation".format(page_id, subscriber_id)
1289
+ return self.post(url)
1290
+
1291
+ def page_create_subscriber(self, page_id, subscriber):
1292
+ """
1293
+ Create a subscriber
1294
+
1295
+ Parameters
1296
+ ----------
1297
+ page_id : str
1298
+ Your page unique ID
1299
+ subscriber : dict[str, any]
1300
+ Subscriber object. You can specify email, endpoint, phone_country, phone_number,
1301
+ skip_confirmation_notification, page_access_user and component_ids. Check notes for all available fields.
1302
+
1303
+ Notes
1304
+ -----
1305
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdSubscribers
1306
+
1307
+ Raises
1308
+ ------
1309
+ requests.exceptions.HTTPError
1310
+ Use `json.loads(exceptions.response.content)` to get API error info
1311
+
1312
+ Returns
1313
+ -------
1314
+ any
1315
+ """
1316
+ url = "v1/pages/{}/subscribers".format(page_id)
1317
+ return self.post(url, data={"subscriber": subscriber})
1318
+
1319
+ def page_get_list_unsubscribed(self, page_id, page=1, per_page=100):
1320
+ """
1321
+ Get a list of unsubscribed subscribers
1322
+
1323
+ Parameters
1324
+ ----------
1325
+ page_id : str
1326
+ Your page unique ID
1327
+ page : int
1328
+ Page offset to fetch. Defaults to 1.
1329
+ per_page : int
1330
+ Number of results to return per page. Defaults to 100.
1331
+
1332
+ Notes
1333
+ -----
1334
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdSubscribersUnsubscribed
1335
+
1336
+ Raises
1337
+ ------
1338
+ requests.exceptions.HTTPError
1339
+ Use `json.loads(exceptions.response.content)` to get API error info
1340
+
1341
+ Returns
1342
+ -------
1343
+ any
1344
+ """
1345
+ url = "v1/pages/{}/unsubscribed".format(page_id)
1346
+ return self.get(url, params={"page": page, "per_page": per_page})
1347
+
1348
+ def page_count_subscribers_by_type(self, page_id, subscriber_type, subscriber_state):
1349
+ """
1350
+ Count subscribers by type
1351
+
1352
+ Parameters
1353
+ ----------
1354
+ page_id : str
1355
+ Your page unique ID
1356
+ subscriber_type : SubscriberType
1357
+ If this is specified, only return subscribers of the specified type.
1358
+ subscriber_state : SubscriberState
1359
+ If this is specified, only return subscribers of the specified state.
1360
+ Specify state "all" to find subscribers in any states.
1361
+
1362
+ Notes
1363
+ -----
1364
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdSubscribersCount
1365
+
1366
+ Raises
1367
+ ------
1368
+ requests.exceptions.HTTPError
1369
+ Use `json.loads(exceptions.response.content)` to get API error info
1370
+
1371
+ Returns
1372
+ -------
1373
+ any
1374
+ """
1375
+ url = "v1/pages/{}/subscribers/count".format(page_id)
1376
+ return self.get(url, params={"type": subscriber_type, "state": subscriber_state})
1377
+
1378
+ def page_get_histogram_of_subscribers_with_state(self, page_id):
1379
+ """
1380
+ Get a histogram of subscribers with state
1381
+
1382
+ Parameters
1383
+ ----------
1384
+ page_id : str
1385
+ Your page unique ID
1386
+
1387
+ Notes
1388
+ -----
1389
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdSubscribersHistogramByState
1390
+
1391
+ Raises
1392
+ ------
1393
+ requests.exceptions.HTTPError
1394
+ Use `json.loads(exceptions.response.content)` to get API error info
1395
+
1396
+ Returns
1397
+ -------
1398
+ any
1399
+ """
1400
+ url = "v1/pages/{}/subscribers/histogram".format(page_id)
1401
+ return self.get(url)
1402
+
1403
+ def page_reactivate_subscribers(self, page_id, subscriber_ids, subscriber_type):
1404
+ """
1405
+ Reactivate a list of quarantined subscribers
1406
+
1407
+ Parameters
1408
+ ----------
1409
+ page_id : str
1410
+ Your page unique ID
1411
+ subscriber_ids : list[str]
1412
+ A list of subscriber ids to reactivate.
1413
+ subscriber_type : SubscriberType
1414
+ If this is present, only reactivate subscribers of this type.
1415
+
1416
+ Notes
1417
+ -----
1418
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdSubscribersReactivate
1419
+
1420
+ Raises
1421
+ ------
1422
+ requests.exceptions.HTTPError
1423
+ Use `json.loads(exceptions.response.content)` to get API error info
1424
+
1425
+ Returns
1426
+ -------
1427
+ any
1428
+ """
1429
+ url = "v1/pages/{}/subscribers/reactivate".format(page_id)
1430
+ return self.post(url, data={"subscribers": subscriber_ids, "type": subscriber_type})
1431
+
1432
+ def page_unsubscribe_subscribers(
1433
+ self, page_id, subscriber_ids, subscriber_type, skip_unsubscription_notification=False
1434
+ ):
1435
+ """
1436
+ Unsubscribe a list of subscribers
1437
+
1438
+ Parameters
1439
+ ----------
1440
+ page_id : str
1441
+ Your page unique ID
1442
+ subscriber_ids : str | list[str]
1443
+ The array of subscriber codes to unsubscribe (limited to 100),
1444
+ or "all" to unsubscribe all subscribers if the number of subscribers is less than 100.
1445
+ subscriber_type : SubscriberType
1446
+ If this is present, only unsubscribe subscribers of this type.
1447
+ skip_unsubscription_notification : bool
1448
+ If this is true, do not send an unsubscription notification to the subscriber.
1449
+
1450
+ Notes
1451
+ -----
1452
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdSubscribersUnsubscribe
1453
+
1454
+ Raises
1455
+ ------
1456
+ requests.exceptions.HTTPError
1457
+ Use `json.loads(exceptions.response.content)` to get API error info
1458
+
1459
+ Returns
1460
+ -------
1461
+ any
1462
+ """
1463
+ url = "v1/pages/{}/subscribers/unsubscribe".format(page_id)
1464
+ return self.post(
1465
+ url,
1466
+ data={
1467
+ "subscribers": subscriber_ids,
1468
+ "type": subscriber_type,
1469
+ "skip_unsubscription_notification": skip_unsubscription_notification,
1470
+ },
1471
+ )
1472
+
1473
+ def page_resend_confirmations_to_subscribers(self, page_id, subscriber_ids):
1474
+ """
1475
+ Resend confirmation emails to a list of subscribers
1476
+
1477
+ Parameters
1478
+ ----------
1479
+ page_id : str
1480
+ Your page unique ID
1481
+ subscriber_ids : str | list[str]
1482
+ The array of subscriber codes to resend confirmations for,
1483
+ or "all" to resend confirmations to all subscribers.
1484
+ Only unconfirmed email subscribers will receive this notification.
1485
+
1486
+ Notes
1487
+ -----
1488
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdSubscribersResendConfirmation
1489
+
1490
+ Raises
1491
+ ------
1492
+ requests.exceptions.HTTPError
1493
+ Use `json.loads(exceptions.response.content)` to get API error info
1494
+
1495
+ Returns
1496
+ -------
1497
+ any
1498
+ """
1499
+ url = "v1/pages/{}/subscribers/resend_confirmation".format(page_id)
1500
+ return self.post(url, data={"subscribers": subscriber_ids})
1501
+
1502
+ def page_create_template(self, page_id, template):
1503
+ """
1504
+ Create a template. "name", "title" and "body" is required in the template.
1505
+
1506
+ Parameters
1507
+ ----------
1508
+ page_id : str
1509
+ Your page unique ID
1510
+ template : dict[str, any]
1511
+ The template to create
1512
+
1513
+ Notes
1514
+ -----
1515
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdIncidentTemplates
1516
+
1517
+
1518
+ Raises
1519
+ ------
1520
+ requests.exceptions.HTTPError
1521
+ Use `json.loads(exceptions.response.content)` to get API error info
1522
+
1523
+ Returns
1524
+ -------
1525
+ any
1526
+ """
1527
+ url = "v1/pages/{}/incident_templates".format(page_id)
1528
+ return self.post(url, data={"template": template})
1529
+
1530
+ def page_get_templates(self, page_id, page=1, per_page=100):
1531
+ """
1532
+ Get a list of templates
1533
+
1534
+ Parameters
1535
+ ----------
1536
+ page_id : str
1537
+ Your page unique ID
1538
+ page : int
1539
+ The page offset to return. Defaults to 1.
1540
+ per_page : int
1541
+ The number of templates to return per page. Defaults to 100.
1542
+ If this is set to 0, a default and maximum limit of 100
1543
+ will be imposed and this endpoint will return paginated data
1544
+ even if this query parameter is not provided.
1545
+
1546
+ Notes
1547
+ -----
1548
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdIncidentTemplates
1549
+
1550
+ Raises
1551
+ ------
1552
+ requests.exceptions.HTTPError
1553
+ Use `json.loads(exceptions.response.content)` to get API error info
1554
+
1555
+ Returns
1556
+ -------
1557
+ any
1558
+ """
1559
+ url = "v1/pages/{}/incident_templates".format(page_id)
1560
+ return self.get(url, params={"page": page, "per_page": per_page})
1561
+
1562
+ def page_create_incident(self, page_id, incident):
1563
+ """
1564
+ Create an incident. "name" is required in the incident.
1565
+
1566
+ Parameters
1567
+ ----------
1568
+ page_id : str
1569
+ Your page unique ID
1570
+ incident : dict[str, any]
1571
+ The incident to create
1572
+
1573
+ Notes
1574
+ -----
1575
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdIncidents
1576
+
1577
+ Raises
1578
+ ------
1579
+ requests.exceptions.HTTPError
1580
+ Use `json.loads(exceptions.response.content)` to get API error info
1581
+
1582
+ Returns
1583
+ -------
1584
+ any
1585
+ """
1586
+ url = "v1/pages/{}/incidents".format(page_id)
1587
+ return self.post(url, data={"incident": incident})
1588
+
1589
+ def page_list_incidents(self, page_id, q, page=1, per_page=100):
1590
+ """
1591
+ Get a list of incidents
1592
+
1593
+ Parameters
1594
+ ----------
1595
+ page_id : str
1596
+ Your page unique ID
1597
+ q : str
1598
+ The search query to filter incidents by. If this is specified, search for the text query string in
1599
+ the incident's name, status, postmortem_body, and incident_updates fields.
1600
+ page : int
1601
+ The page offset to return. Defaults to 1.
1602
+ per_page : int
1603
+ The number of incidents to return per page. Defaults to 100.
1604
+ If this is set to 0, a default and maximum limit of 100
1605
+ will be imposed and this endpoint will return paginated data
1606
+ even if this query parameter is not provided.
1607
+
1608
+ Notes
1609
+ -----
1610
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdIncidents
1611
+
1612
+ Raises
1613
+ ------
1614
+ requests.exceptions.HTTPError
1615
+ Use `json.loads(exceptions.response.content)` to get API error info
1616
+
1617
+ Returns
1618
+ -------
1619
+ any
1620
+ """
1621
+ url = "v1/pages/{}/incidents".format(page_id)
1622
+ return self.get(url, params={"q": q, "page": page, "per_page": per_page})
1623
+
1624
+ def page_list_active_maintenances(self, page_id, page=1, per_page=100):
1625
+ """
1626
+ Get a list of active maintenances
1627
+
1628
+ Parameters
1629
+ ----------
1630
+ page_id : str
1631
+ Your page unique ID
1632
+ page : int
1633
+ The page offset to return. Defaults to 1.
1634
+ per_page : int
1635
+ The number of maintenances to return per page. Defaults to 100.
1636
+ If this is set to 0, a default and maximum limit of 100
1637
+ will be imposed and this endpoint will return paginated data
1638
+ even if this query parameter is not provided.
1639
+
1640
+ Notes
1641
+ -----
1642
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdIncidentsActiveMaintenance
1643
+
1644
+ Raises
1645
+ ------
1646
+ requests.exceptions.HTTPError
1647
+ Use `json.loads(exceptions.response.content)` to get API error info
1648
+
1649
+ Returns
1650
+ -------
1651
+ any
1652
+ """
1653
+ url = "v1/pages/{}/incidents/active_maintenance".format(page_id)
1654
+ return self.get(url, params={"page": page, "per_page": per_page})
1655
+
1656
+ def page_list_upcoming_incidents(self, page_id, page=1, per_page=100):
1657
+ """
1658
+ Get a list of upcoming incidents
1659
+
1660
+ Parameters
1661
+ ----------
1662
+ page_id : str
1663
+ Your page unique ID
1664
+ page : int
1665
+ The page offset to return. Defaults to 1.
1666
+ per_page : int
1667
+ The number of incidents to return per page. Defaults to 100.
1668
+ If this is set to 0, a default and maximum limit of 100
1669
+ will be imposed and this endpoint will return paginated data
1670
+ even if this query parameter is not provided.
1671
+
1672
+ Notes
1673
+ -----
1674
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdIncidentsUpcoming
1675
+
1676
+ Raises
1677
+ ------
1678
+ requests.exceptions.HTTPError
1679
+ Use `json.loads(exceptions.response.content)` to get API error info
1680
+
1681
+ Returns
1682
+ -------
1683
+ any
1684
+ """
1685
+ url = "v1/pages/{}/incidents/upcoming".format(page_id)
1686
+ return self.get(url, params={"page": page, "per_page": per_page})
1687
+
1688
+ def page_list_scheduled_incidents(self, page_id, page=1, per_page=100):
1689
+ """
1690
+ Get a list of scheduled incidents
1691
+
1692
+ Parameters
1693
+ ----------
1694
+ page_id : str
1695
+ Your page unique ID
1696
+ page : int
1697
+ The page offset to return. Defaults to 1.
1698
+ per_page : int
1699
+ The number of incidents to return per page. Defaults to 100.
1700
+ If this is set to 0, a default and maximum limit of 100
1701
+ will be imposed and this endpoint will return paginated data
1702
+ even if this query parameter is not provided.
1703
+
1704
+ Notes
1705
+ -----
1706
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdIncidentsScheduled
1707
+
1708
+ Raises
1709
+ ------
1710
+ requests.exceptions.HTTPError
1711
+ Use `json.loads(exceptions.response.content)` to get API error info
1712
+
1713
+ Returns
1714
+ -------
1715
+ any
1716
+ """
1717
+ url = "v1/pages/{}/incidents/scheduled".format(page_id)
1718
+ return self.get(url, params={"page": page, "per_page": per_page})
1719
+
1720
+ def page_list_unresolved_incidents(self, page_id, page=1, per_page=100):
1721
+ """
1722
+ Get a list of unresolved incidents
1723
+
1724
+ Parameters
1725
+ ----------
1726
+ page_id : str
1727
+ Your page unique ID
1728
+ page : int
1729
+ The page offset to return. Defaults to 1.
1730
+ per_page : int
1731
+ The number of incidents to return per page. Defaults to 100.
1732
+ If this is set to 0, a default and maximum limit of 100
1733
+ will be imposed and this endpoint will return paginated data
1734
+ even if this query parameter is not provided.
1735
+
1736
+ Notes
1737
+ -----
1738
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdIncidentsUnresolved
1739
+
1740
+ Raises
1741
+ ------
1742
+ requests.exceptions.HTTPError
1743
+ Use `json.loads(exceptions.response.content)` to get API error info
1744
+
1745
+ Returns
1746
+ -------
1747
+ any
1748
+ """
1749
+ url = "v1/pages/{}/incidents/unresolved".format(page_id)
1750
+ return self.get(url, params={"page": page, "per_page": per_page})
1751
+
1752
+ def page_delete_incident(self, page_id, incident_id):
1753
+ """
1754
+ Delete an incident
1755
+
1756
+ Parameters
1757
+ ----------
1758
+ page_id : str
1759
+ Your page unique ID
1760
+ incident_id : str
1761
+ The incident unique ID
1762
+
1763
+ Raises
1764
+ ------
1765
+ requests.exceptions.HTTPError
1766
+ Use `json.loads(exceptions.response.content)` to get API error info
1767
+
1768
+ Returns
1769
+ -------
1770
+ any
1771
+ """
1772
+ url = "v1/pages/{}/incidents/{}".format(page_id, incident_id)
1773
+ return self.delete(url)
1774
+
1775
+ def page_update_incident(self, page_id, incident_id, incident):
1776
+ """
1777
+ Update an incident
1778
+
1779
+ Parameters
1780
+ ----------
1781
+ page_id : str
1782
+ Your page unique ID
1783
+ incident_id : str
1784
+ The incident unique ID
1785
+ incident : dict[str, any]
1786
+ The incident data to update
1787
+
1788
+ Notes
1789
+ -----
1790
+ See available fields: https://developer.statuspage.io/#operation/patchPagesPageIdIncidentsIncidentId
1791
+
1792
+ Raises
1793
+ ------
1794
+ requests.exceptions.HTTPError
1795
+ Use `json.loads(exceptions.response.content)` to get API error info
1796
+
1797
+ Returns
1798
+ -------
1799
+ any
1800
+ """
1801
+ url = "v1/pages/{}/incidents/{}".format(page_id, incident_id)
1802
+ return self.patch(url, data={"incident": incident})
1803
+
1804
+ def page_get_incident(self, page_id, incident_id):
1805
+ """
1806
+ Get an incident
1807
+
1808
+ Parameters
1809
+ ----------
1810
+ page_id : str
1811
+ Your page unique ID
1812
+ incident_id : str
1813
+ The incident unique ID
1814
+
1815
+ Notes
1816
+ -----
1817
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdIncidentsIncidentId
1818
+
1819
+ Raises
1820
+ ------
1821
+ requests.exceptions.HTTPError
1822
+ Use `json.loads(exceptions.response.content)` to get API error info
1823
+
1824
+ Returns
1825
+ -------
1826
+ any
1827
+ """
1828
+ url = "v1/pages/{}/incidents/{}".format(page_id, incident_id)
1829
+ return self.get(url)
1830
+
1831
+ def page_update_incident_updates(self, page_id, incident_id, incident_update_id, incident_update):
1832
+ """
1833
+ Update a previous incident update
1834
+
1835
+ Parameters
1836
+ ----------
1837
+ page_id : str
1838
+ Your page unique ID
1839
+ incident_id : str
1840
+ The incident unique ID
1841
+ incident_update_id : str
1842
+ The incident update unique ID
1843
+ incident_update : dict[str, any]
1844
+ The incident update data to update
1845
+
1846
+ Notes
1847
+ -----
1848
+ See available fields: https://developer.statuspage.io/#operation/patchPagesPageIdIncidentsIncidentIdIncidentUpdatesIncidentUpdateId
1849
+ # noqa: E501
1850
+
1851
+ Raises
1852
+ ------
1853
+ requests.exceptions.HTTPError
1854
+ Use `json.loads(exceptions.response.content)` to get API error info
1855
+
1856
+ Returns
1857
+ -------
1858
+ any
1859
+ """
1860
+ url = "v1/pages/{}/incidents/{}/incidents_update/{}".format(page_id, incident_id, incident_update_id)
1861
+ return self.patch(url, data={"incident_update": incident_update})
1862
+
1863
+ def page_create_incident_subscriber(self, page_id, incident_id, subscriber):
1864
+ """
1865
+ Create a subscriber for an incident
1866
+
1867
+ Parameters
1868
+ ----------
1869
+ page_id : str
1870
+ Your page unique ID
1871
+ incident_id : str
1872
+ The incident unique ID
1873
+ subscriber : dict[str, any]
1874
+ The subscriber data to create
1875
+
1876
+ Notes
1877
+ -----
1878
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdIncidentsIncidentIdSubscribers
1879
+
1880
+ Raises
1881
+ ------
1882
+ requests.exceptions.HTTPError
1883
+ Use `json.loads(exceptions.response.content)` to get API error info
1884
+
1885
+ Returns
1886
+ -------
1887
+ any
1888
+ """
1889
+ url = "v1/pages/{}/incidents/{}/subscribers".format(page_id, incident_id)
1890
+ return self.post(url, data={"subscriber": subscriber})
1891
+
1892
+ def page_list_incident_subscribers(self, page_id, incident_id, page=1, per_page=100):
1893
+ """
1894
+ Get a list of subscribers for an incident
1895
+
1896
+ Parameters
1897
+ ----------
1898
+ page_id : str
1899
+ Your page unique ID
1900
+ incident_id : str
1901
+ The incident unique ID
1902
+ page : int
1903
+ The page offset to return. Defaults to 1.
1904
+ per_page : int
1905
+ The number of subscribers to return per page. Defaults to 100.
1906
+
1907
+ Notes
1908
+ -----
1909
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdIncidentsIncidentIdSubscribers
1910
+
1911
+ Raises
1912
+ ------
1913
+ requests.exceptions.HTTPError
1914
+ Use `json.loads(exceptions.response.content)` to get API error info
1915
+
1916
+ Returns
1917
+ -------
1918
+ any
1919
+ """
1920
+ url = "v1/pages/{}/incidents/{}/subscribers".format(page_id, incident_id)
1921
+ return self.get(url, params={"page": page, "per_page": per_page})
1922
+
1923
+ def page_unsubscribe_incident_subscriber(self, page_id, incident_id, subscriber_id):
1924
+ """
1925
+ Unsubscribe a subscriber from an incident
1926
+
1927
+ Parameters
1928
+ ----------
1929
+ page_id : str
1930
+ Your page unique ID
1931
+ incident_id : str
1932
+ The incident unique ID
1933
+ subscriber_id : str
1934
+ The subscriber unique ID
1935
+
1936
+ Raises
1937
+ ------
1938
+ requests.exceptions.HTTPError
1939
+ Use `json.loads(exceptions.response.content)` to get API error info
1940
+
1941
+ Returns
1942
+ -------
1943
+ any
1944
+ """
1945
+ url = "v1/pages/{}/incidents/{}/subscribers/{}".format(page_id, incident_id, subscriber_id)
1946
+ return self.delete(url)
1947
+
1948
+ def page_get_incident_subscriber(self, page_id, incident_id, subscriber_id):
1949
+ """
1950
+ Get a subscriber for an incident
1951
+
1952
+ Parameters
1953
+ ----------
1954
+ page_id : str
1955
+ Your page unique ID
1956
+ incident_id : str
1957
+ The incident unique ID
1958
+ subscriber_id : str
1959
+ The subscriber unique ID
1960
+
1961
+ Notes
1962
+ -----
1963
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdIncidentsIncidentIdSubscribersSubscriberId
1964
+ # noqa: E501
1965
+
1966
+ Raises
1967
+ ------
1968
+ requests.exceptions.HTTPError
1969
+ Use `json.loads(exceptions.response.content)` to get API error info
1970
+
1971
+ Returns
1972
+ -------
1973
+ any
1974
+ """
1975
+ url = "v1/pages/{}/incidents/{}/subscribers/{}".format(page_id, incident_id, subscriber_id)
1976
+ return self.get(url)
1977
+
1978
+ def page_resend_confirmation_incident_subscriber(self, page_id, incident_id, subscriber_id):
1979
+ """
1980
+ Resend the confirmation email for a subscriber
1981
+
1982
+ Parameters
1983
+ ----------
1984
+ page_id : str
1985
+ Your page unique ID
1986
+ incident_id : str
1987
+ The incident unique ID
1988
+ subscriber_id : str
1989
+ The subscriber unique ID
1990
+
1991
+ Warnings
1992
+ --------
1993
+ Only returns 201 code
1994
+
1995
+ Raises
1996
+ ------
1997
+ requests.exceptions.HTTPError
1998
+ Use `json.loads(exceptions.response.content)` to get API error info
1999
+
2000
+ Returns
2001
+ -------
2002
+ any
2003
+ """
2004
+ url = "v1/pages/{}/incidents/{}/subscribers/{}/resend_confirmation".format(page_id, incident_id, subscriber_id)
2005
+ return self.post(url)
2006
+
2007
+ def page_get_postmortem(self, page_id, incident_id):
2008
+ """
2009
+ Get a postmortem
2010
+
2011
+ Parameters
2012
+ ----------
2013
+ page_id : str
2014
+ Your page unique ID
2015
+ incident_id : str
2016
+ The incident unique ID
2017
+
2018
+ Notes
2019
+ -----
2020
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdIncidentsIncidentIdPostmortem
2021
+
2022
+ Raises
2023
+ ------
2024
+ requests.exceptions.HTTPError
2025
+ Use `json.loads(exceptions.response.content)` to get API error info
2026
+
2027
+ Returns
2028
+ -------
2029
+ any
2030
+ """
2031
+ url = "v1/pages/{}/incidents/{}/postmortem".format(page_id, incident_id)
2032
+ return self.get(url)
2033
+
2034
+ def page_create_postmortem(self, page_id, incident_id, postmortem):
2035
+ """
2036
+ Create a postmortem
2037
+
2038
+ Parameters
2039
+ ----------
2040
+ page_id : str
2041
+ Your page unique ID
2042
+ incident_id : str
2043
+ The incident unique ID
2044
+ postmortem : str
2045
+ Body of Postmortem to create.
2046
+
2047
+ Notes
2048
+ -----
2049
+ See available fields: https://developer.statuspage.io/#operation/putPagesPageIdIncidentsIncidentIdPostmortem
2050
+
2051
+ Raises
2052
+ ------
2053
+ requests.exceptions.HTTPError
2054
+ Use `json.loads(exceptions.response.content)` to get API error info
2055
+
2056
+ Returns
2057
+ -------
2058
+ any
2059
+ """
2060
+ url = "v1/pages/{}/incidents/{}/postmortem".format(page_id, incident_id)
2061
+ return self.post(url, data={"postmortem": {"body_draft": postmortem}})
2062
+
2063
+ def page_delete_postmortem(self, page_id, incident_id):
2064
+ """
2065
+ Delete a postmortem
2066
+
2067
+ Parameters
2068
+ ----------
2069
+ page_id : str
2070
+ Your page unique ID
2071
+ incident_id : str
2072
+ The incident unique ID
2073
+
2074
+ Raises
2075
+ ------
2076
+ requests.exceptions.HTTPError
2077
+ Use `json.loads(exceptions.response.content)` to get API error info
2078
+
2079
+ Notes
2080
+ -----
2081
+ See available fields: https://developer.statuspage.io/#operation/deletePagesPageIdIncidentsIncidentIdPostmortem
2082
+
2083
+ Returns
2084
+ -------
2085
+ any
2086
+ """
2087
+ url = "v1/pages/{}/incidents/{}/postmortem".format(page_id, incident_id)
2088
+ return self.delete(url)
2089
+
2090
+ def page_publish_postmortem(self, page_id, incident_id, postmortem):
2091
+ """
2092
+ Publish a postmortem
2093
+
2094
+ Parameters
2095
+ ----------
2096
+ page_id : str
2097
+ Your page unique ID
2098
+ incident_id : str
2099
+ The incident unique ID
2100
+ postmortem : dict[str, any]
2101
+ Body of Postmortem to publish
2102
+ Available fields: "notify_twitter", "notify_subscribers", and "custom_tweet"
2103
+
2104
+ Raises
2105
+ ------
2106
+ requests.exceptions.HTTPError
2107
+ Use `json.loads(exceptions.response.content)` to get API error info
2108
+
2109
+ Notes
2110
+ -----
2111
+ See available fields: https://developer.statuspage.io/#operation/putPagesPageIdIncidentsIncidentIdPostmortemPublish
2112
+ # noqa: E501
2113
+
2114
+ Returns
2115
+ -------
2116
+ any
2117
+ """
2118
+ url = "v1/pages/{}/incidents/{}/postmortem/publish".format(page_id, incident_id)
2119
+ return self.post(url, data={"postmortem": postmortem})
2120
+
2121
+ def page_revert_postmortem(self, page_id, incident_id):
2122
+ """
2123
+ Revert a postmortem
2124
+
2125
+ Parameters
2126
+ ----------
2127
+ page_id : str
2128
+ Your page unique ID
2129
+ incident_id : str
2130
+ The incident unique ID
2131
+
2132
+ Raises
2133
+ ------
2134
+ requests.exceptions.HTTPError
2135
+ Use `json.loads(exceptions.response.content)` to get API error info
2136
+
2137
+ Notes
2138
+ -----
2139
+ See available fields: https://developer.statuspage.io/#operation/putPagesPageIdIncidentsIncidentIdPostmortemRevert
2140
+ # noqa: E501
2141
+
2142
+ Returns
2143
+ -------
2144
+ any
2145
+ """
2146
+ url = "v1/pages/{}/incidents/{}/postmortem/revert".format(page_id, incident_id)
2147
+ return self.post(url)
2148
+
2149
+ def page_create_component(self, page_id, component):
2150
+ """
2151
+ Create a component
2152
+
2153
+ Parameters
2154
+ ----------
2155
+ page_id : str
2156
+ Your page unique ID
2157
+ component : dict[str, any]
2158
+ The component to create
2159
+ Available fields: "name", "description", "status", "group_id", "showcase", "only_show_if_degraded",
2160
+ and "start_date"
2161
+
2162
+ Raises
2163
+ ------
2164
+ requests.exceptions.HTTPError
2165
+ Use `json.loads(exceptions.response.content)` to get API error info
2166
+
2167
+ Notes
2168
+ -----
2169
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdComponents
2170
+
2171
+ Returns
2172
+ -------
2173
+ any
2174
+ """
2175
+ url = "v1/pages/{}/components".format(page_id)
2176
+ return self.post(url, data={"component": component})
2177
+
2178
+ def page_get_components(self, page_id, per_page=100, page=1):
2179
+ """
2180
+ Get all components
2181
+
2182
+ Parameters
2183
+ ----------
2184
+ page_id : str
2185
+ Your page unique ID
2186
+ per_page : int
2187
+ Number of components to return per page (default is 100)
2188
+ page : int
2189
+ Page number to return (default is 1)
2190
+
2191
+ Notes
2192
+ -----
2193
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdComponents
2194
+
2195
+ Raises
2196
+ ------
2197
+ requests.exceptions.HTTPError
2198
+ Use `json.loads(exceptions.response.content)` to get API error info
2199
+
2200
+ Returns
2201
+ -------
2202
+ any
2203
+ """
2204
+ url = "v1/pages/{}/components".format(page_id)
2205
+ return self.get(url, params={"per_page": per_page, "page": page})
2206
+
2207
+ def page_update_component(self, page_id, component_id, component):
2208
+ """
2209
+ Update a component
2210
+
2211
+ Warnings
2212
+ --------
2213
+ If "group_id" is Null then the component will be removed from a group
2214
+
2215
+ Parameters
2216
+ ----------
2217
+ page_id : str
2218
+ Your page unique ID
2219
+ component_id : str
2220
+ The component unique ID
2221
+ component : dict[str, any]
2222
+ The component to update
2223
+ Available fields: "name", "description", "status", "group_id", "showcase", "only_show_if_degraded",
2224
+ and "start_date"
2225
+
2226
+ Raises
2227
+ ------
2228
+ requests.exceptions.HTTPError
2229
+ Use `json.loads(exceptions.response.content)` to get API error info
2230
+
2231
+ Notes
2232
+ -----
2233
+ See available fields: https://developer.statuspage.io/#operation/patchPagesPageIdComponentsComponentId
2234
+
2235
+ Returns
2236
+ -------
2237
+ any
2238
+ """
2239
+ url = "v1/pages/{}/components/{}".format(page_id, component_id)
2240
+ return self.patch(url, data={"component": component})
2241
+
2242
+ def page_delete_component(self, page_id, component_id):
2243
+ """
2244
+ Delete a component
2245
+
2246
+ Parameters
2247
+ ----------
2248
+ page_id : str
2249
+ Your page unique ID
2250
+ component_id : str
2251
+ The component unique ID
2252
+
2253
+ Raises
2254
+ ------
2255
+ requests.exceptions.HTTPError
2256
+ Use `json.loads(exceptions.response.content)` to get API error info
2257
+
2258
+ Notes
2259
+ -----
2260
+ See available fields: https://developer.statuspage.io/#operation/deletePagesPageIdComponentsComponentId
2261
+
2262
+ Returns
2263
+ -------
2264
+ any
2265
+ """
2266
+ url = "v1/pages/{}/components/{}".format(page_id, component_id)
2267
+ return self.delete(url)
2268
+
2269
+ def page_get_component(self, page_id, component_id):
2270
+ """
2271
+ Get a component
2272
+
2273
+ Parameters
2274
+ ----------
2275
+ page_id : str
2276
+ Your page unique ID
2277
+ component_id : str
2278
+ The component unique ID
2279
+
2280
+ Raises
2281
+ ------
2282
+ requests.exceptions.HTTPError
2283
+ Use `json.loads(exceptions.response.content)` to get API error info
2284
+
2285
+ Notes
2286
+ -----
2287
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdComponentsComponentId
2288
+
2289
+ Returns
2290
+ -------
2291
+ any
2292
+ """
2293
+ url = "v1/pages/{}/components/{}".format(page_id, component_id)
2294
+ return self.get(url)
2295
+
2296
+ def page_get_uptime_component(self, page_id, component_id, start=None, end=None):
2297
+ """
2298
+ Get a component's uptime
2299
+
2300
+ Parameters
2301
+ ----------
2302
+ page_id : str
2303
+ Your page unique ID
2304
+ component_id : str
2305
+ The component unique ID
2306
+ start : str
2307
+ The start date for uptime calculation
2308
+ (defaults to the component's start_date field or 90 days ago, whichever is more recent).
2309
+ The maximum supported date range is six calendar months.
2310
+ If the year is given, the date defaults to the first day of the year.
2311
+ If the year and month are given, the start date defaults to the first day of that month.
2312
+ The earliest supported date is January 1, 1970.
2313
+ end : str
2314
+ The end date for uptime calculation (defaults to today in the page's time zone).
2315
+ The maximum supported date range is six calendar months.
2316
+ If the year is given, the date defaults to the last day of the year.
2317
+ If the year and month are given, the date defaults to the last day of that month.
2318
+ The earliest supported date is January 1, 1970.
2319
+
2320
+ Raises
2321
+ ------
2322
+ requests.exceptions.HTTPError
2323
+ Use `json.loads(exceptions.response.content)` to get API error info
2324
+
2325
+ Notes
2326
+ -----
2327
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdComponentsComponentIdUptime
2328
+
2329
+ Returns
2330
+ -------
2331
+ any
2332
+ """
2333
+ url = "v1/pages/{}/components/{}/uptime".format(page_id, component_id)
2334
+
2335
+ params = {}
2336
+ if start is not None:
2337
+ params["start"] = start
2338
+ if end is not None:
2339
+ params["end"] = end
2340
+
2341
+ return self.get(url, params=params)
2342
+
2343
+ def page_remove_access_users_from_component(self, page_id, component_id):
2344
+ """
2345
+ Remove access users from a component
2346
+
2347
+ Parameters
2348
+ ----------
2349
+ page_id : str
2350
+ Your page unique ID
2351
+ component_id : str
2352
+ The component unique ID
2353
+
2354
+ Raises
2355
+ ------
2356
+ requests.exceptions.HTTPError
2357
+ Use `json.loads(exceptions.response.content)` to get API error info
2358
+
2359
+ Notes
2360
+ -----
2361
+ See available fields: https://developer.statuspage.io/#operation/deletePagesPageIdComponentsComponentIdPageAccessUsers
2362
+ # noqa: E501
2363
+
2364
+ Returns
2365
+ -------
2366
+ any
2367
+ """
2368
+ url = "v1/pages/{}/components/{}/page_access_users".format(page_id, component_id)
2369
+ return self.delete(url)
2370
+
2371
+ def page_add_access_users_to_component(self, page_id, component_id, page_access_user_ids):
2372
+ """
2373
+ Add access users to a component
2374
+
2375
+ Parameters
2376
+ ----------
2377
+ page_id : str
2378
+ Your page unique ID
2379
+ component_id : str
2380
+ The component unique ID
2381
+ page_access_user_ids : list[str]
2382
+ The users to add
2383
+
2384
+ Raises
2385
+ ------
2386
+ requests.exceptions.HTTPError
2387
+ Use `json.loads(exceptions.response.content)` to get API error info
2388
+
2389
+ Notes
2390
+ -----
2391
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdComponentsComponentIdPageAccessUsers
2392
+ # noqa: E501
2393
+
2394
+ Returns
2395
+ -------
2396
+ any
2397
+ """
2398
+ url = "v1/pages/{}/components/{}/page_access_users".format(page_id, component_id)
2399
+ return self.post(url, data={"page_access_user_ids": page_access_user_ids})
2400
+
2401
+ def page_remove_access_users_from_group(self, page_id, component_id):
2402
+ """
2403
+ Remove access users from a group
2404
+
2405
+ Parameters
2406
+ ----------
2407
+ page_id : str
2408
+ Your page unique ID
2409
+ component_id : str
2410
+ The component unique ID
2411
+
2412
+ Raises
2413
+ ------
2414
+ requests.exceptions.HTTPError
2415
+ Use `json.loads(exceptions.response.content)` to get API error info
2416
+
2417
+ Notes
2418
+ -----
2419
+ See available fields: https://developer.statuspage.io/#operation/deletePagesPageIdComponentsComponentIdPageAccessGroups
2420
+ # noqa: E501
2421
+
2422
+ Returns
2423
+ -------
2424
+ any
2425
+ """
2426
+ url = "v1/pages/{}/components/{}/page_access_groups".format(page_id, component_id)
2427
+ return self.delete(url)
2428
+
2429
+ def page_add_access_users_to_group(self, page_id, component_id, page_access_group_ids):
2430
+ """
2431
+ Add page access groups to a component
2432
+
2433
+ Parameters
2434
+ ----------
2435
+ page_id : str
2436
+ Your page unique ID
2437
+ component_id : str
2438
+ The component unique ID
2439
+ page_access_group_ids : list[str]
2440
+ The groups to add
2441
+
2442
+ Raises
2443
+ ------
2444
+ requests.exceptions.HTTPError
2445
+ Use `json.loads(exceptions.response.content)` to get API error info
2446
+
2447
+ Notes
2448
+ -----
2449
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdComponentsComponentIdPageAccessGroups
2450
+ # noqa: E501
2451
+
2452
+ Returns
2453
+ -------
2454
+ any
2455
+ """
2456
+ url = "v1/pages/{}/components/{}/page_access_groups".format(page_id, component_id)
2457
+ return self.post(url, data={"page_access_group_ids": page_access_group_ids})
2458
+
2459
+ def page_create_component_group(self, page_id, description, components_group):
2460
+ """
2461
+ Create a component group
2462
+
2463
+ Parameters
2464
+ ----------
2465
+ page_id : str
2466
+ Your page unique ID
2467
+ description : str
2468
+ The description of the component group
2469
+ components_group : dick[str, any]
2470
+ The components to add to the group
2471
+ Available fields: "components" (array of strings), "name"
2472
+
2473
+ Raises
2474
+ ------
2475
+ requests.exceptions.HTTPError
2476
+ Use `json.loads(exceptions.response.content)` to get API error info
2477
+
2478
+ Notes
2479
+ -----
2480
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdComponentGroups
2481
+
2482
+ Returns
2483
+ -------
2484
+ any
2485
+ """
2486
+ url = "v1/pages/{}/component_groups".format(page_id)
2487
+ return self.post(url, data={"description": description, "components_group": components_group})
2488
+
2489
+ def page_get_list_of_component_groups(self, page_id, per_page=100, page=1):
2490
+ """
2491
+ Get a list of component groups
2492
+
2493
+ Parameters
2494
+ ----------
2495
+ page_id : str
2496
+ Your page unique ID
2497
+ per_page : int
2498
+ The number of results to return per page (defaults to 100)
2499
+ page : int
2500
+ The page to return (defaults to 1)
2501
+
2502
+ Raises
2503
+ ------
2504
+ requests.exceptions.HTTPError
2505
+ Use `json.loads(exceptions.response.content)` to get API error info
2506
+
2507
+ Notes
2508
+ -----
2509
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdComponentGroups
2510
+
2511
+ Returns
2512
+ -------
2513
+ any
2514
+ """
2515
+ url = "v1/pages/{}/component_groups".format(page_id)
2516
+ return self.get(url, params={"per_page": per_page, "page": page})
2517
+
2518
+ def page_update_component_group(self, page_id, component_group_id, description, component_group):
2519
+ """
2520
+ Update a component group
2521
+
2522
+ Parameters
2523
+ ----------
2524
+ page_id : str
2525
+ Your page unique ID
2526
+ component_group_id : str
2527
+ Component group identifier
2528
+ description : str
2529
+ The description of the component group
2530
+ component_group : dict[str, any]
2531
+ The components to update
2532
+ Available fields: "name", "components" (array of strings)
2533
+
2534
+ Raises
2535
+ ------
2536
+ requests.exceptions.HTTPError
2537
+ Use `json.loads(exceptions.response.content)` to get API error info
2538
+
2539
+ Notes
2540
+ -----
2541
+ See available fields: https://developer.statuspage.io/#operation/patchPagesPageIdComponentGroupsId
2542
+
2543
+ Returns
2544
+ -------
2545
+ any
2546
+ """
2547
+ url = "v1/pages/{}/component_groups/{}".format(page_id, component_group_id)
2548
+ return self.patch(url, data={"description": description, "component_group": component_group})
2549
+
2550
+ def page_delete_component_group(self, page_id, component_group_id):
2551
+ """
2552
+ Delete a component group
2553
+
2554
+ Parameters
2555
+ ----------
2556
+ page_id : str
2557
+ Your page unique ID
2558
+ component_group_id : str
2559
+ Component group identifier
2560
+
2561
+ Raises
2562
+ ------
2563
+ requests.exceptions.HTTPError
2564
+ Use `json.loads(exceptions.response.content)` to get API error info
2565
+
2566
+ Notes
2567
+ -----
2568
+ See available fields: https://developer.statuspage.io/#operation/deletePagesPageIdComponentGroupsId
2569
+
2570
+ Returns
2571
+ -------
2572
+ any
2573
+ """
2574
+ url = "v1/pages/{}/component_groups/{}".format(page_id, component_group_id)
2575
+ return self.delete(url)
2576
+
2577
+ def page_get_component_group(self, page_id, component_group_id):
2578
+ """
2579
+ Get a component group
2580
+
2581
+ Parameters
2582
+ ----------
2583
+ page_id : str
2584
+ Your page unique ID
2585
+ component_group_id : str
2586
+ Component group identifier
2587
+
2588
+ Raises
2589
+ ------
2590
+ requests.exceptions.HTTPError
2591
+ Use `json.loads(exceptions.response.content)` to get API error info
2592
+
2593
+ Notes
2594
+ -----
2595
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdComponentGroupsId
2596
+
2597
+ Returns
2598
+ -------
2599
+ any
2600
+ """
2601
+ url = "v1/pages/{}/component_groups/{}".format(page_id, component_group_id)
2602
+ return self.get(url)
2603
+
2604
+ def page_get_uptime_for_component_group(self, page_id, component_group_id, start=None, end=None):
2605
+ """
2606
+ Get uptime for a component group
2607
+
2608
+ Parameters
2609
+ ----------
2610
+ page_id : str
2611
+ Your page unique ID
2612
+ component_group_id : str
2613
+ Component group identifier
2614
+ start : str
2615
+ The start date for uptime calculation
2616
+ (defaults to the date of the component in the group with the earliest start_date,
2617
+ or 90 days ago, whichever is more recent).
2618
+ The maximum supported date range is six calendar months.
2619
+ If the year is given, the date defaults to the first day of the year.
2620
+ If the year and month are given, the start date defaults to the first day of that month.
2621
+ The earliest supported date is January 1, 1970.
2622
+ end : str
2623
+ The end date for uptime calculation (defaults to today in the page's time zone).
2624
+ The maximum supported date range is six calendar months.
2625
+ If the year is given, the date defaults to the last day of the year.
2626
+ If the year and month are given, the date defaults to the last day of that month.
2627
+ The earliest supported date is January 1, 1970.
2628
+
2629
+ Raises
2630
+ ------
2631
+ requests.exceptions.HTTPError
2632
+ Use `json.loads(exceptions.response.content)` to get API error info
2633
+
2634
+ Notes
2635
+ -----
2636
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdComponentGroupsIdUptime
2637
+
2638
+ Returns
2639
+ -------
2640
+ any
2641
+ """
2642
+ url = "v1/pages/{}/component_groups/{}/uptime".format(page_id, component_group_id)
2643
+
2644
+ params = {}
2645
+ if start is not None:
2646
+ params["start"] = start
2647
+ if end is not None:
2648
+ params["end"] = end
2649
+
2650
+ return self.get(url, params=params)
2651
+
2652
+ def page_add_data_points_to_metric(self, page_id, data):
2653
+ """
2654
+ Add data points to a metric
2655
+
2656
+ Parameters
2657
+ ----------
2658
+ page_id : str
2659
+ Your page unique ID
2660
+ data : dict[str, any]
2661
+ The data points to add
2662
+ Requires "metric_id", which specifies identifier to add data to
2663
+ In "metric_id" you should have array of "timestamp" and "value"
2664
+
2665
+ Raises
2666
+ ------
2667
+ requests.exceptions.HTTPError
2668
+ Use `json.loads(exceptions.response.content)` to get API error info
2669
+
2670
+ Notes
2671
+ -----
2672
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdMetricsData
2673
+
2674
+ Returns
2675
+ -------
2676
+ any
2677
+ """
2678
+ url = "v1/pages/{}/metrics/data".format(page_id)
2679
+ return self.post(url, data={"data": data})
2680
+
2681
+ def page_get_list_of_metrics(self, page_id, per_page=100, page=1):
2682
+ """
2683
+ Get a list of metrics
2684
+
2685
+ Parameters
2686
+ ----------
2687
+ page_id : str
2688
+ Your page unique ID
2689
+ per_page : int
2690
+ The number of results to return per page (defaults to 100)
2691
+ page : int
2692
+ The page to return (defaults to 1)
2693
+
2694
+ Raises
2695
+ ------
2696
+ requests.exceptions.HTTPError
2697
+ Use `json.loads(exceptions.response.content)` to get API error info
2698
+
2699
+ Notes
2700
+ -----
2701
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdMetrics
2702
+
2703
+ Returns
2704
+ -------
2705
+ any
2706
+ """
2707
+ url = "v1/pages/{}/metrics".format(page_id)
2708
+ return self.get(url, params={"per_page": per_page, "page": page})
2709
+
2710
+ def page_update_metric(self, page_id, metric_id, metric):
2711
+ """
2712
+ Update a metric
2713
+
2714
+ Parameters
2715
+ ----------
2716
+ page_id : str
2717
+ Your page unique ID
2718
+ metric_id : str
2719
+ Metric identifier
2720
+ metric : dict[str, any]
2721
+ The metric to update
2722
+
2723
+ Available fields in metric: "name", "metric_identifier"
2724
+ "name" - Name of metric,
2725
+ "metric_identifier" - Metric Display identifier used to look up the metric data from the provider
2726
+
2727
+ Raises
2728
+ ------
2729
+ requests.exceptions.HTTPError
2730
+ Use `json.loads(exceptions.response.content)` to get API error info
2731
+
2732
+ Notes
2733
+ -----
2734
+ See available fields: https://developer.statuspage.io/#operation/patchPagesPageIdMetricsMetricId
2735
+
2736
+ Returns
2737
+ -------
2738
+ any
2739
+ """
2740
+ url = "v1/pages/{}/metrics/{}".format(page_id, metric_id)
2741
+ return self.patch(url, data={"metric": metric})
2742
+
2743
+ def page_update_metric_data(self, page_id, metric_id, metric):
2744
+ """
2745
+ Update metric data
2746
+
2747
+ Parameters
2748
+ ----------
2749
+ page_id : str
2750
+ Your page unique ID
2751
+ metric_id : str
2752
+ Metric identifier
2753
+ metric : dict[str, any]
2754
+ The metric to update
2755
+
2756
+ Available fields in metric: "name", "metric_identifier"
2757
+ "name" - Name of metric,
2758
+ "metric_identifier" - Metric Display identifier used to look up the metric data from the provider
2759
+
2760
+ Raises
2761
+ ------
2762
+ requests.exceptions.HTTPError
2763
+ Use `json.loads(exceptions.response.content)` to get API error info
2764
+
2765
+ Notes
2766
+ -----
2767
+ See available fields: https://developer.statuspage.io/#operation/patchPagesPageIdMetricsMetricId
2768
+
2769
+ Returns
2770
+ -------
2771
+ any
2772
+ """
2773
+ url = "v1/pages/{}/metrics/{}".format(page_id, metric_id)
2774
+ return self.patch(url, data={"metric": metric})
2775
+
2776
+ def page_delete_metric(self, page_id, metric_id):
2777
+ """
2778
+ Delete a metric
2779
+
2780
+ Parameters
2781
+ ----------
2782
+ page_id : str
2783
+ Your page unique ID
2784
+ metric_id : str
2785
+ Metric identifier
2786
+
2787
+ Raises
2788
+ ------
2789
+ requests.exceptions.HTTPError
2790
+ Use `json.loads(exceptions.response.content)` to get API error info
2791
+
2792
+ Notes
2793
+ -----
2794
+ See available fields: https://developer.statuspage.io/#operation/deletePagesPageIdMetricsMetricId
2795
+
2796
+ Returns
2797
+ -------
2798
+ any
2799
+ """
2800
+ url = "v1/pages/{}/metrics/{}".format(page_id, metric_id)
2801
+ return self.delete(url)
2802
+
2803
+ def page_get_metric(self, page_id, metric_id):
2804
+ """
2805
+ Get a metric
2806
+
2807
+ Parameters
2808
+ ----------
2809
+ page_id : str
2810
+ Your page unique ID
2811
+ metric_id : str
2812
+ Metric identifier
2813
+
2814
+ Raises
2815
+ ------
2816
+ requests.exceptions.HTTPError
2817
+ Use `json.loads(exceptions.response.content)` to get API error info
2818
+
2819
+ Notes
2820
+ -----
2821
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdMetricsMetricId
2822
+
2823
+ Returns
2824
+ -------
2825
+ any
2826
+ """
2827
+ url = "v1/pages/{}/metrics/{}".format(page_id, metric_id)
2828
+ return self.get(url)
2829
+
2830
+ def page_reset_data_for_metric(self, page_id, metric_id):
2831
+ """
2832
+ Reset data for a metric
2833
+
2834
+ Parameters
2835
+ ----------
2836
+ page_id : str
2837
+ Your page unique ID
2838
+ metric_id : str
2839
+ Metric identifier
2840
+
2841
+ Raises
2842
+ ------
2843
+ requests.exceptions.HTTPError
2844
+ Use `json.loads(exceptions.response.content)` to get API error info
2845
+
2846
+ Notes
2847
+ -----
2848
+ See available fields: https://developer.statuspage.io/#operation/deletePagesPageIdMetricsMetricIdData
2849
+
2850
+ Returns
2851
+ -------
2852
+ any
2853
+ """
2854
+ url = "v1/pages/{}/metrics/{}/data".format(page_id, metric_id)
2855
+ return self.delete(url)
2856
+
2857
+ def page_add_data_to_metric(self, page_id, metric_id, data):
2858
+ """
2859
+ Add data to a metric
2860
+
2861
+ Parameters
2862
+ ----------
2863
+ page_id : str
2864
+ Your page unique ID
2865
+ metric_id : str
2866
+ Metric identifier
2867
+ data : dict[str, any]
2868
+ The data to add
2869
+
2870
+ Requires "timestamp" and "value"
2871
+
2872
+ Raises
2873
+ ------
2874
+ requests.exceptions.HTTPError
2875
+ Use `json.loads(exceptions.response.content)` to get API error info
2876
+
2877
+ Notes
2878
+ -----
2879
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdMetricsMetricIdData
2880
+
2881
+ Returns
2882
+ -------
2883
+ any
2884
+ """
2885
+ url = "v1/pages/{}/metrics/{}/data".format(page_id, metric_id)
2886
+ return self.post(url, data={"data": data})
2887
+
2888
+ def page_list_metric_for_metric_provider(self, page_id, metric_provider_id, per_page=100, page=1):
2889
+ """
2890
+ List metrics for a metric provider
2891
+
2892
+ Parameters
2893
+ ----------
2894
+ page_id : str
2895
+ Your page unique ID
2896
+ metric_provider_id : str
2897
+ Metric provider identifier
2898
+ per_page : int
2899
+ The number of results to return per page (defaults to 100)
2900
+ page : int
2901
+ The page to return (defaults to 1)
2902
+
2903
+ Raises
2904
+ ------
2905
+ requests.exceptions.HTTPError
2906
+ Use `json.loads(exceptions.response.content)` to get API error info
2907
+
2908
+ Notes
2909
+ -----
2910
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdMetricsProvidersMetricsProviderIdMetrics
2911
+ # noqa: E501
2912
+
2913
+ Returns
2914
+ -------
2915
+ any
2916
+ """
2917
+ url = "v1/pages/{}/metrics_providers/{}/metrics".format(page_id, metric_provider_id)
2918
+ return self.get(url, params={"per_page": per_page, "page": page})
2919
+
2920
+ def page_create_metric_for_metric_provider(self, page_id, metric_provider_id, metric):
2921
+ """
2922
+ Create a metric for a metric provider
2923
+
2924
+ Parameters
2925
+ ----------
2926
+ page_id : str
2927
+ Your page unique ID
2928
+ metric_provider_id : str
2929
+ Metric provider identifier
2930
+ metric : dict[str, any]
2931
+ The metric to create
2932
+
2933
+ Available fields in metric: "name", "metric_identifier", "transform", "suffix",
2934
+ "y_axis_min", "y_axis_max", "y_axis_hidden", "display",
2935
+ "decimal_places", "tooltip_description"
2936
+
2937
+ Raises
2938
+ ------
2939
+ requests.exceptions.HTTPError
2940
+ Use `json.loads(exceptions.response.content)` to get API error info
2941
+
2942
+ Notes
2943
+ -----
2944
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdMetricsProvidersMetricsProviderIdMetrics
2945
+ # noqa: E501
2946
+
2947
+ Descriptions of the fields that can be added to the metric:
2948
+ "name" - Name of metric,
2949
+
2950
+ "metric_identifier" - The identifier used to look up the metric data from the provider
2951
+
2952
+ "transform" - The transform to apply to metric before pulling into Statuspage.
2953
+ See transform enum for available values
2954
+
2955
+ "suffix" - Suffix to describe the units on the graph
2956
+
2957
+ "y_axis_min" - Minimum value for the y-axis
2958
+
2959
+ "y_axis_max" - Maximum value for the y-axis
2960
+
2961
+ "y_axis_hidden" - Should the values on the y-axis be hidden on render
2962
+
2963
+ "display" - Should the metric be displayed on the status page
2964
+
2965
+ "decimal_places" - How many decimal places to render on the graph
2966
+
2967
+ "tooltip_description" - Description to show on the tooltip
2968
+
2969
+ Returns
2970
+ -------
2971
+ any
2972
+ """
2973
+ url = "v1/pages/{}/metrics_providers/{}/metrics".format(page_id, metric_provider_id)
2974
+ return self.post(url, data={"metric": metric})
2975
+
2976
+ def page_list_metric_providers(self, page_id):
2977
+ """
2978
+ Get a list of metric providers
2979
+
2980
+ Parameters
2981
+ ----------
2982
+ page_id : str
2983
+ Your page unique ID
2984
+ Raises
2985
+ ------
2986
+ requests.exceptions.HTTPError
2987
+ Use `json.loads(exceptions.response.content)` to get API error info
2988
+
2989
+ Notes
2990
+ -----
2991
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdMetricsProviders
2992
+
2993
+ Returns
2994
+ -------
2995
+ any
2996
+ """
2997
+ url = "v1/pages/{}/metrics_providers".format(page_id)
2998
+ return self.get(url)
2999
+
3000
+ def page_create_metric_provider(self, page_id, metric_provider):
3001
+ """
3002
+ Create a metric provider
3003
+
3004
+ Parameters
3005
+ ----------
3006
+ page_id : str
3007
+ Your page unique ID
3008
+ metric_provider : dict[str, any]
3009
+ The metric provider to create
3010
+
3011
+ Available fields in metric_provider: "email", "password", "api_key", "api_token",
3012
+ "application_key", "type", "metric_base_uri"
3013
+
3014
+ Raises
3015
+ ------
3016
+ requests.exceptions.HTTPError
3017
+ Use `json.loads(exceptions.response.content)` to get API error info
3018
+
3019
+ Notes
3020
+ -----
3021
+ See available fields: https://developer.statuspage.io/#operation/postPagesPageIdMetricsProviders
3022
+
3023
+ Descriptions of the fields that can be added to the metric_provider:
3024
+ "email" - Required by the Librato metrics provider
3025
+
3026
+ "password" - Just a password!
3027
+
3028
+ "api_key" - Required by the Datadog and NewRelic type metrics providers
3029
+
3030
+ "api_token" - Required by the Librato, Datadog and Pingdom type metrics providers
3031
+
3032
+ "application_key" - Required by the Pingdom-type metrics provider
3033
+
3034
+ "type" - The type of metrics provider. See MetricProviderType enum for available values
3035
+
3036
+ "metric_base_uri" - The base URI for the metrics provider.
3037
+ Required by the Datadog and NewRelic type metrics providers.
3038
+
3039
+
3040
+ Returns
3041
+ -------
3042
+ any
3043
+ """
3044
+ url = "v1/pages/{}/metrics_providers".format(page_id)
3045
+ return self.post(url, data={"metric_provider": metric_provider})
3046
+
3047
+ def page_get_metric_provider(self, page_id, metric_provider_id):
3048
+ """
3049
+ Get a metric provider
3050
+
3051
+ Parameters
3052
+ ----------
3053
+ page_id : str
3054
+ Your page unique ID
3055
+ metric_provider_id : str
3056
+ Metric provider identifier
3057
+
3058
+ Raises
3059
+ ------
3060
+ requests.exceptions.HTTPError
3061
+ Use `json.loads(exceptions.response.content)` to get API error info
3062
+
3063
+ Notes
3064
+ -----
3065
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdMetricsProvidersMetricsProviderId
3066
+
3067
+ Returns
3068
+ -------
3069
+ any
3070
+ """
3071
+ url = "v1/pages/{}/metrics_providers/{}".format(page_id, metric_provider_id)
3072
+ return self.get(url)
3073
+
3074
+ def page_update_metric_provider(self, page_id, metric_provider_id, metric_provider):
3075
+ """
3076
+ Update a metric provider
3077
+
3078
+ Parameters
3079
+ ----------
3080
+ page_id : str
3081
+ Your page unique ID
3082
+ metric_provider_id : str
3083
+ Metric provider identifier
3084
+ metric_provider : dict[str, any]
3085
+ Metric provider to update
3086
+
3087
+
3088
+ Raises
3089
+ ------
3090
+ requests.exceptions.HTTPError
3091
+ Use `json.loads(exceptions.response.content)` to get API error info
3092
+
3093
+ Notes
3094
+ -----
3095
+ See available fields: https://developer.statuspage.io/#operation/getPagesPageIdMetricsProvidersMetricsProviderId
3096
+
3097
+ Available fields in metric_provider: "type", "metric_base_uri"
3098
+
3099
+ Descriptions of the fields that can be added to the metric_provider:
3100
+ "type" - The type of metrics provider. See MetricProviderType enum for available values
3101
+
3102
+ "metric_base_uri" - The base URI for the metrics provider.
3103
+ Required by the Datadog and NewRelic type metrics providers.
3104
+
3105
+ Returns
3106
+ -------
3107
+ any
3108
+ """
3109
+ url = "v1/pages/{}/metrics_providers/{}".format(page_id, metric_provider_id)
3110
+ return self.patch(url, data={"metric_provider": metric_provider})
3111
+
3112
+ def page_delete_metric_provider(self, page_id, metric_provider_id):
3113
+ """
3114
+ Delete a metric provider
3115
+
3116
+ Parameters
3117
+ ----------
3118
+ page_id : str
3119
+ Your page unique ID
3120
+ metric_provider_id : str
3121
+ Metric provider identifier
3122
+
3123
+ Raises
3124
+ ------
3125
+ requests.exceptions.HTTPError
3126
+ Use `json.loads(exceptions.response.content)` to get API error info
3127
+
3128
+ Returns
3129
+ -------
3130
+ any
3131
+ """
3132
+ url = "v1/pages/{}/metrics_providers/{}".format(page_id, metric_provider_id)
3133
+ return self.delete(url)