diegozea / MIToS.jl

A Julia package to analyze protein sequences, structures, and evolutionary information

Home Page:https://diegozea.github.io/MIToS.jl/stable/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Set user agent for pdb dowbload

javieriserte opened this issue · comments

Add option:
-A "Mozilla/5.0 (compatible; MSIE 7.01; Windows NT 5.0)"
to curl to emulate browser if normal download gives error 503 (service unavailable).

https://curl.haxx.se/docs/httpscripting.html#User_Agent
http://osxdaily.com/2011/07/16/change-user-agent-with-curl/
http://www.dougsparling.org/setting-user-agent-curl-wget/

MIToS 2.0 introduces a download_file in the Utils module. download_file calls the get_streaming function of the Requests package using the same keyword arguments. So, you can use the header argument to set the user agent using a Dict. That keyword argument will be also available in downloadpdb, because that function calls download_file. So, the following line does is going to do the magic in the future release of MIToS (2.1.1) ;)

downloadpdb("1IVO", headers=Dict("User-Agent" => "Mozilla/5.0 (compatible; MSIE 7.01; Windows NT 5.0)"))