Answer the question
In order to leave comments, you need to log in
Why doesn't request give the entire html code of the page?
I'm doing a regular normal get request using the requests library and not getting all the html code of the page.
The code:
r = requests.get(resource_main_url, timeout=30, headers={"content-type":"text"})
return r.text
h2 class="five_news_title onlytext"
Answer the question
In order to leave comments, you need to log in
There is a suspicion that you are getting a mobile version. Or the bot version . To avoid this, you need to pretend to be a browser. Give the same headers as the browser. First of all, User-Agent from Chrome or FireFox.
There might also be a 403 (Access Denied) error or something similar, again because of the headers.
Another option is that you crossed the path to them. They figured you out, and now they want to interfere with you so that you stop parsing them. Moreover, you need to disguise yourself, at the same time reduce the RPS to a very rare one so as not to burn, and even so you will not interfere with anyone.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question