Can't download file using user-agent

2019-09-13 03:27发布

问题:

I am trying to download a PDF using a user-agent. This is the link:

http://docstore.ohchr.org/SelfServices/FilesHandler.ashx?enc=6QkG1d%2fPPRiCAqhKb7yhsm7cEzPuG%2bIuSsjbaxhB%2b5vM0qgl%2bI%2bWZbIXqai7dQjlQHIySQ1HA8jayiBtura5uBz8YKKmXzyI%2fQxLt%2b1ik4JdCe7BQMFZngbVTePkj7ib

If I follow this link in a browser it downloads a PDF. But when I do it via a user-agent I get a response that includes the following message:

There is an end-user problem. If you have reached this site from a web link, - Through your internet options, adjust your privacy settings to allow cookies or - Check your security settings and make sure this site has not been blocked or - You are probably using a very slow link that may not work well with this application. Otherwise you have reached this site through unauthorized means.

The user-agent I am using is Mechanize in perl. Obviously the site doesn't like me using a user-agent instead of a browser. What can I do to allow the PDF to download? I have many more to download from the same site.