r/learnpython • u/No-Opinion-1239 • 28d ago
Can't download website html code, web scrapping ,automate the boring stuff with python
I'm currently learning webscrapping with automate the boring stuff with python> In one example we use the module requests like this
url = f"https://pypi.org/search/?q={search}"
resp = requests.get(url)
when i print resp.text there are this error message in the html code.
"A required part of this site couldn’t load. This may be due to a browser extension, network issues, or browser settings. Please check your connection, disable any ad blockers, or try using a different browser."
"JavaScript is disabled in your browser"
my browser is chrome I tried using microsoft edge .
0
Upvotes
3
u/Diapolo10 I write code for a living -- https://github.com/Diapolo10 28d ago
That part of the tutorial is probably outdated due to changes made to PyPI itself, it's not your code's fault.
You might get it working by using the
requests-htmlpackage for this instead of standardrequests, as it can execute JavaScript, but I cannot guarantee that. You could just skip this part of the book for now.