Can't download file using user-agent

早过忘川 提交于 2019-12-25 08:58:49

问题


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.

来源:https://stackoverflow.com/questions/35714411/cant-download-file-using-user-agent

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!