Python Requests Get XML -


if go http://boxinsider.cratejoy.com/feed/ can see xml fine. when try access using python requests, 403 error.

    blog_url = 'http://boxinsider.cratejoy.com/feed/'     headers = {'accepts': 'text/html,application/xml'}     blog_request = requests.get(blog_url, timeout=10, headers=headers) 

any ideas on why?

because it's hosted wpengine , filter user agents.

try this:

user_agent = "mozilla/5.0 (macintosh; intel mac os x 10_10_3) applewebkit/537.36 (khtml, gecko) chrome/42.0.2311.152 safari/537.36"  requests.get('http://boxinsider.cratejoy.com/feed/', headers={'user-agent': user_agent}) 

Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -