Skip to content

Commit 73a9141

Browse files
authored
adding headers in marketplace API calls (#1028)
1 parent 79f4161 commit 73a9141

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/test/scripts/update_versions.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77

88
import product_versions
99

10+
# USER_AGENT constant for marketplace API calls
11+
USER_AGENT = "Mozilla_dc_core_eng"
12+
1013
"""
1114
This script is used to update the product versions in the helm charts descriptors (Chart.yaml).
1215
It fetches the latest available version (LTS for products with LTS) from marketplace and updates the required
@@ -67,7 +70,8 @@ def product_versions_marketplace(product_key):
6770
page = 1
6871
while True:
6972
logging.debug(f'Retrieving Marketplace product versions for {product_key}: page {page}')
70-
r = requests.get(mac_url + request_url, params=params)
73+
headers = {'User-Agent': USER_AGENT}
74+
r = requests.get(mac_url + request_url, params=params, headers=headers)
7175
version_data = r.json()
7276
for version in version_data['_embedded']['versions']:
7377
if all(d.isdigit() for d in version['name'].split('.')):
@@ -130,7 +134,8 @@ def update_mesh_tag():
130134
logging.info("Latest LTS version: %s", version)
131135
else:
132136
logging.info("Non-LTS product")
133-
r = requests.get(f'https://marketplace.atlassian.com/rest/2/products/key/{product}/versions/latest')
137+
headers = {'User-Agent': USER_AGENT}
138+
r = requests.get(f'https://marketplace.atlassian.com/rest/2/products/key/{product}/versions/latest', headers=headers)
134139
version = r.json()['name']
135140

136141
new_version_tag = f"{version}{tag_suffix}"

0 commit comments

Comments
 (0)