Issue
When trying to get html code from link (https://sourceforge.net/projects/easyminer/files/latest/download) I'm getting a lot of weird symbols.
However, it's not happening when trying with other websites.
Solution
If you specify a User-Agent
as normal browser, sourceforge will return a html page, otherwise a 302 redirect to the binary download link.
>>> r = requests.get("https://sourceforge.net/projects/easyminer/files/latest/download", headers={"User-agent": "Mozilla/5.0"})
>>> r.text[:50]
'<!doctype html>\n<!-- Server: sfs-consume-5 -->\n<ht'
Answered By - emptyhua
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.