Skip to content
Merged
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 integrations/investing.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
# Earnings constants
EARNINGS_URL = "https://www.investing.com/earnings-calendar/Service/getCalendarFilteredData"
EARNINGS_HEADERS = {
"User-Agent": "Mozilla/5.0",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/x-www-form-urlencoded",
"Referer": "https://www.investing.com/earnings-calendar/",
Expand All @@ -22,7 +22,7 @@
# IPO constants
IPO_URL = "https://www.investing.com/ipo-calendar/Service/getCalendarFilteredData"
IPO_HEADERS = {
"User-Agent": "Mozilla/5.0",
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36",
Copy link

Choose a reason for hiding this comment

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

Duplicate User-Agent string should be extracted to constant

Low Severity

The same 128-character User-Agent string is duplicated verbatim in EARNINGS_HEADERS (line 16) and IPO_HEADERS (line 25). Extract this to a single constant like CHROME_USER_AGENT and reference it in both header dictionaries.

Fix in Cursor Fix in Web

"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/x-www-form-urlencoded",
"Referer": "https://www.investing.com/ipo-calendar/",
Expand Down