Skip to content

Commit ff5deb6

Browse files
authored
Merge pull request #57 from zerothy/feat/new-scraper-api
hotfix(scraper): realistic header
2 parents 06c2cf7 + b217c92 commit ff5deb6

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scraper/siak_ng_scraper.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,16 @@ def login(session, username, password):
5757
yield format_sse({
5858
"type": "status", "message": f"Authenticating as {username}..."
5959
}, event='log')
60+
61+
# Add more realistic headers to avoid detection
62+
session.headers.update({
63+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
64+
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
65+
'Accept-Language': 'en-US,en;q=0.5',
66+
'Accept-Encoding': 'gzip, deflate',
67+
'Connection': 'keep-alive',
68+
'Upgrade-Insecure-Requests': '1',
69+
})
6070

6171
# 1. Login to the authentication page using username and password
6272
pre_request()

0 commit comments

Comments
 (0)