Skip to content

Commit ac8870e

Browse files
committed
Jira: Add fields fix request 1484
1 parent 8151e3a commit ac8870e

File tree

6 files changed

+16
-15
lines changed

6 files changed

+16
-15
lines changed

atlassian/confluence.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,8 @@ def get_tables_from_page(self, page_id):
390390
"""
391391
Fetches html tables added to confluence page
392392
:param page_id: integer confluence page_id
393-
:return: json object with page_id, number_of_tables_in_page and list of list tables_content representing scrapepd tables
393+
:return: json object with page_id, number_of_tables_in_page
394+
and list of list tables_content representing scraped tables
394395
"""
395396
try:
396397
page_content = self.get_page_by_id(page_id, expand="body.storage")["body"]["storage"]["value"]
@@ -736,7 +737,8 @@ def get_all_pages_by_space_ids_confluence_cloud(
736737
:param batch_size: OPTIONAL: The batch size of pages to retrieve from confluence per request MAX is 250.
737738
Default: 250
738739
:param sort: OPTIONAL: The order the pages are retrieved in.
739-
Valid values: id, -id, created-date, -created-date, modified-date, -modified-date, title, -title
740+
Valid values:
741+
id, -id, created-date, -created-date, modified-date, -modified-date, title, -title
740742
:param status: OPTIONAL: Filter pages based on their status.
741743
Valid values: current, archived, deleted, trashed
742744
Default: current,archived
@@ -2735,15 +2737,17 @@ def get_space_export(self, space_key: str, export_type: str) -> str:
27352737
"""
27362738
Export a Confluence space to a file of the specified type.
27372739
(!) This method was developed for Confluence Cloud and may not work with Confluence on-prem.
2738-
(!) This is an experimental method that does not trigger an officially supported REST endpoint. It may break if Atlassian changes the space export front-end logic.
2740+
(!) This is an experimental method that does not trigger an officially supported REST endpoint.
2741+
It may break if Atlassian changes the space export front-end logic.
27392742
27402743
:param space_key: The key of the space to export.
27412744
:param export_type: The type of export to perform. Valid values are: 'html', 'csv', 'xml', 'pdf'.
27422745
:return: The URL to download the exported file.
27432746
"""
27442747

27452748
def get_atl_request(url: str):
2746-
# Nested function used to get atl_token used for XSRF protection. this is only applicable to html/csv/xml space exports
2749+
# Nested function used to get atl_token used for XSRF protection.
2750+
# This is only applicable to html/csv/xml space exports
27472751
try:
27482752
response = self.get(url, advanced_mode=True)
27492753
parsed_html = BeautifulSoup(response.text, "html.parser")

atlassian/jira.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,12 +656,16 @@ def get_custom_field_option(self, option_id):
656656
def get_custom_fields(self, search=None, start=1, limit=50):
657657
"""
658658
Get custom fields. Evaluated on 7.12
659+
Get fields paginated in cloud
659660
:param search: str
660661
:param start: long Default: 1
661662
:param limit: int Default: 50
662663
:return:
663664
"""
664-
url = self.resource_url("customFields")
665+
if self.cloud:
666+
url = self.resource_url("field/search")
667+
else:
668+
url = self.resource_url("customFields")
665669
params = {}
666670
if search:
667671
params["search"] = search

atlassian/rest_client.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,8 @@ def __init__(
113113
Defaults to 1.0.
114114
:param retry_with_header: Enable retry logic based on the `Retry-After` header.
115115
If set to True, the request will automatically retry if the response
116-
contains a `Retry-After` header with a delay and has a status code of 429. The retry delay will be extracted
116+
contains a `Retry-After` header with a delay and has a status code of 429.
117+
The retry delay will be extracted
117118
from the `Retry-After` header and the request will be paused for the specified
118119
duration before retrying. Defaults to True.
119120
If the `Retry-After` header is not present, retries will not occur.
@@ -253,7 +254,7 @@ def _calculate_backoff_value(self, retry_count):
253254
"""
254255
backoff_value = self.backoff_factor * (2 ** (retry_count - 1))
255256
if self.backoff_jitter != 0.0:
256-
backoff_value += random.random() * self.backoff_jitter
257+
backoff_value += random.uniform(0, self.backoff_jitter) # nosec B311
257258
return float(max(0, min(self.max_backoff_seconds, backoff_value)))
258259

259260
def _retry_handler(self):

examples/jira/jira_download_attachments.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
JIRA_LOGIN = "admin"
88
JIRA_TOKEN = "dsadd2c3s"
99

10-
11-
def get_tickets(jql):
12-
pass
13-
14-
1510
if __name__ == "__main__":
1611
jira = Jira(url=JIRA_URL, username=JIRA_LOGIN, token=JIRA_TOKEN)
1712
jql = "project = DOC"

examples/jira/jira_jql_fetcher_as_weekly_report.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ def __fetch_user_activity(self, user):
3131
jql = "((assignee was in ({})) OR assignee in ({})) AND updated > -{}d ".format(user, user, self.days)
3232
print("Start fetching info jql = {}".format(jql))
3333
while flag:
34-
values = []
3534
try:
3635
response = self.jira.jql(
3736
jql,

examples/jira/jira_notification_schemes_duplicates.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,7 @@ def compare_dicts(dict1, dict2, print_diffs=False):
2626

2727

2828
def review():
29-
notification_scheme_dict = {}
3029
all_notification_schemes_dict = {}
31-
3230
notification_schemes_ids = jira.get_notification_schemes()
3331
names = []
3432

0 commit comments

Comments
 (0)