#!/usr/bin/env python3

# Copyright 2022 The Kubernetes Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import json
import requests

url = 'https://api.github.com/search/issues?q=is:issue+label:official-cve-feed+\
state:closed+repo:kubernetes/kubernetes'
headers = {'Accept': 'application/vnd.github.v3+json'}
res = requests.get(url, headers=headers)
cve_arr = res.json()

cve_list = []

for item in cve_arr['items']:
    cve = {"issue_url": None, "number": None, "cve_id": None,
           "summary": None, "cve_url": None, "google_group_url": None}
    cve['issue_url'] = item['html_url']
    cve['number'] = item['number']
    title = item['title'].replace(" -", ":")
    title = title.split(": ")
    if len(title) == 1:
        cve_id = None
        cve['cve_id'] = None
        cve['cve_url'] = None
        cve['summary'] = title[0]
        cve['google_group_url'] = None
    else:
        cve_id = title[0]
        cve['cve_id'] = title[0]
        if len(title) == 3:
            cve['summary'] = title[2]
        else:
            cve['summary'] = title[1]
        cve['cve_url'] = f"https://www.cvedetails.com/cve-details.php?cve_id={cve_id}"
        cve['google_group_url'] = \
        f"https://groups.google.com/g/kubernetes-announce/search?q={cve_id}"
    cve_list.append(cve)
cves = json.dumps(cve_list, sort_keys=True, indent=4)
print(cves)
# write the final cve list to official_cve_feed.json
with open("official-cve-feed.json", "w") as cvejson:
    cvejson.write(cves)

@@ -754,17 +754,310 @@
 bernetes
-'
+&per_page=100'%0A# %60per_page%60 sets the number of results that can be returned without using pagination. Current number of in-scope issues are 38. %0A# Note: When total number of inscope issues are more than 100, it is suggested to use pagination to avoid inconsistent results%0A# because of timeouts.
 %0Aheaders

Increase default no. of results for Github Search API