I'm doing:
HTTPoison.get! "https://www.nature.com/articles/d41586-020-00741-x"
Which works fine in the browser but gives me a 303 when I try and fetch the page with HTTPoison.
What am I doing wrong?
I'm doing:
HTTPoison.get! "https://www.nature.com/articles/d41586-020-00741-x"
Which works fine in the browser but gives me a 303 when I try and fetch the page with HTTPoison.
What am I doing wrong?
Copyright © 2021 Jogjafile Inc.
The 303 status code is a redirection code. In order to follow the redirection, you need to pass the option to HTTPoison to follow it:
However, you most likely will need to pass a
:force_redirectoption to Hackney as well, since AFAIK it doesn't accept 303 as a valid redirect status code.So, a working version would be:
Which will produce: