Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/Identify_Old_Issue_And_PR.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def is_old_pull_request(issue):

# Grab the list of open Issues/PR
buffer = "Grab the list of open Issues/PR via the GitHub API...\n"
response = requests.get(ISSUE_API)
response = requests.get(ISSUE_API, timeout=30)
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR description mentions "multiple scripts" lacking request timeouts, but this change only updates Identify_Old_Issue_And_PR.py. For example, scripts/Generate_RSS_Feed.py and scripts/Generate_Technologies_JSON.py still call requests.get(...) without a timeout (as of current main). Either expand the fix set or narrow the PR description/scope accordingly.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requests.get(..., timeout=30) can raise requests.exceptions.Timeout/RequestException before status_code is available. Right now that would crash the script with a traceback. Wrap this call in a try/except requests.exceptions.RequestException and exit with code 1 (and a clear message) on network/timeout failures.

Suggested change
response = requests.get(ISSUE_API, timeout=30)
try:
response = requests.get(ISSUE_API, timeout=30)
except requests.exceptions.RequestException as exc:
print("Cannot load the list of Issues/PR content: %s" % exc)
sys.exit(1)

Copilot uses AI. Check for mistakes.
if response.status_code != 200:
print("Cannot load the list of Issues/PR content: HTTP %s received!" % response.status_code)
sys.exit(1)
Expand Down Expand Up @@ -91,7 +91,7 @@ def is_old_pull_request(issue):
color = "warning"
message = "{\"text\": \"Old PR and Issue identification watchdog\",\"attachments\": [ {\"fallback\": \"%s\",\"color\":\"%s\",\"title\": \"Status\",\"text\": \"%s\"}]}" % (color, buffer, buffer)
request_headers = {"Content-Type": "application/json"}
response = requests.post(sys.argv[1], headers=request_headers, data=message)
response = requests.post(sys.argv[1], headers=request_headers, data=message, timeout=30)
if response.status_code != 200:
print("Cannot send notification to slack: HTTP %s received!" % response.status_code)
sys.exit(2)
Comment on lines +94 to 97
Copy link

Copilot AI Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

requests.post(..., timeout=30) can raise requests.exceptions.Timeout/RequestException and currently would terminate the script with an unhandled exception. Consider catching requests.exceptions.RequestException around the Slack webhook call and exiting with code 2 while printing a concise error (including that a timeout occurred).

Copilot uses AI. Check for mistakes.
Loading