1
1
import datetime
2
2
from enum import Enum
3
3
from typing import List
4
+ import urllib .parse
4
5
5
6
from pybuildkite .client import Client
6
7
from pybuildkite .exceptions import (
@@ -81,7 +82,7 @@ def list_all(
81
82
with_pagination = False ,
82
83
):
83
84
"""
84
- Returns a paginated list of all builds across all the user’ s organizations and pipelines. If using
85
+ Returns a paginated list of all builds across all the user' s organizations and pipelines. If using
85
86
token-based authentication the list of builds will be for the authorized organizations only. Builds are
86
87
listed in the order they were created (newest first).
87
88
@@ -93,11 +94,11 @@ def list_all(
93
94
:param meta_data: Filters the results by the given meta_data. Example: ?meta_data[some-key]=some-value
94
95
:param branch: Filters the results by the given branch or branches.
95
96
:param commit: Filters the results by the commit (only works for full sha, not for shortened ones).
96
- :param include_retried_jobs: Include all retried job executions in each build’ s jobs list if True.
97
+ :param include_retried_jobs: Include all retried job executions in each build' s jobs list if True.
97
98
Without this parameter, you'll see only the most recently run job for each step.
98
99
:param page: Int to determine which page to read from (See Pagination in README)
99
100
:param with_pagination: Bool to return a response with pagination attributes
100
- :return: Returns a paginated list of all builds across all the user’ s organizations and pipelines
101
+ :return: Returns a paginated list of all builds across all the user' s organizations and pipelines
101
102
"""
102
103
self .__validate_dates ([created_from , created_to , finished_from ])
103
104
self .__are_valid_states (states )
@@ -135,7 +136,7 @@ def list_all_for_org(
135
136
with_pagination = False ,
136
137
):
137
138
"""
138
- Returns a paginated list of an organization’ s builds across all of an organization’ s pipelines. Builds are
139
+ Returns a paginated list of an organization' s builds across all of an organization' s pipelines. Builds are
139
140
listed in the order they were created (newest first).
140
141
141
142
:param organization: Organization slug
@@ -147,11 +148,11 @@ def list_all_for_org(
147
148
:param meta_data: Filters the results by the given meta_data.
148
149
:param branch: Filters the results by the given branch or branches.
149
150
:param commit: Filters the results by the commit (only works for full sha, not for shortened ones).
150
- :param include_retried_jobs: Include all retried job executions in each build’ s jobs list if True.
151
+ :param include_retried_jobs: Include all retried job executions in each build' s jobs list if True.
151
152
Without this parameter, you'll see only the most recently run job for each step.
152
153
:param page: Int to determine which page to read from (See Pagination in README)
153
154
:param with_pagination: Bool to return a response with pagination attributes
154
- :return: Returns a paginated list of an organization’ s builds across all of an organization’ s pipelines.
155
+ :return: Returns a paginated list of an organization' s builds across all of an organization' s pipelines.
155
156
"""
156
157
157
158
self .__validate_dates ([created_from , created_to , finished_from ])
@@ -193,7 +194,7 @@ def list_all_for_pipeline(
193
194
with_pagination = False ,
194
195
):
195
196
"""
196
- Returns a paginated list of a pipeline’ s builds. Builds are listed in the order they were created (newest
197
+ Returns a paginated list of a pipeline' s builds. Builds are listed in the order they were created (newest
197
198
first).
198
199
199
200
:param organization: Organization slug
@@ -206,11 +207,11 @@ def list_all_for_pipeline(
206
207
:param meta_data: Filters the results by the given meta_data.
207
208
:param branch: Filters the results by the given branch or branches.
208
209
:param commit: Filters the results by the commit (only works for full sha, not for shortened ones).
209
- :param include_retried_jobs: Include all retried job executions in each build’ s jobs list if True.
210
+ :param include_retried_jobs: Include all retried job executions in each build' s jobs list if True.
210
211
Without this parameter, you'll see only the most recently run job for each step.
211
212
:param page: Int to determine which page to read from (See Pagination in README)
212
213
:param with_pagination: Bool to return a response with pagination attributes
213
- :return: Returns a paginated list of a pipeline’ s builds.
214
+ :return: Returns a paginated list of a pipeline' s builds.
214
215
"""
215
216
216
217
self .__validate_dates ([created_from , created_to , finished_from ])
@@ -244,7 +245,7 @@ def get_build_by_number(
244
245
:param organization: Organization slug
245
246
:param pipeline: Pipeline slug
246
247
:param build_number: Build number
247
- :param include_retried_jobs: Include all retried job executions in each build’ s jobs list if True.
248
+ :param include_retried_jobs: Include all retried job executions in each build' s jobs list if True.
248
249
Without this parameter, you'll see only the most recently run job for each step.
249
250
:return: A build
250
251
"""
@@ -376,7 +377,9 @@ def __get_branches_query_param(branches):
376
377
if isinstance (branches , List ):
377
378
param_string = ""
378
379
for branch in branches :
379
- param_string += "branch[]={}&" .format (branch )
380
+ encoded_branch = urllib .parse .quote_plus (branch )
381
+ param_string += f"branch[]={{}}&" .format (encoded_branch )
380
382
return param_string [:- 1 ]
381
383
else :
382
- return "branch=" + branches
384
+ encoded_branch = urllib .parse .quote_plus (branches )
385
+ return f"branch={{}}" .format (encoded_branch )
0 commit comments