Answer the question
In order to leave comments, you need to log in
Where is the error with request python (I get status code = 400)?
import requests
url="http://www.booking.com/reviewlist.en-gb.html?pagename=quot-bielis-quot;cc1=xa"
page = requests.get(url)
if page.status_code==200:
print 'OK'
else:
print 'error page code:',page.status_code
Answer the question
In order to leave comments, you need to log in
It's all about User-Agent
Try this:
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
response = requests.get(url, headers=headers)
from fake_useragent import UserAgent
ua = UserAgent()
headers = {'User-Agent': ua.random}
response = requests.get(url, headers=headers)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question