[R] open a zip file
Roy Mendelssohn - NOAA Federal
roy.mendelssohn at noaa.gov
Mon Aug 8 04:07:20 CEST 2016
If I break it into parts, I find that the "GET" fails.
> Year <- format(Sys.Date(), "%Y")
> Month <- format(Sys.Date(), "%m")
> junk <- paste("https://mbsdisclosure.fanniemae.com/disclosure-docs/monthly/",
+ "mbs",
+ as.character(Month),
+ as.character(Year),
+ ".zip",
+ sep = "")
> junk
[1] "https://mbsdisclosure.fanniemae.com/disclosure-docs/monthly/mbs082016.zip"
> httr::GET("https://mbsdisclosure.fanniemae.com/disclosure-docs/monthly/mbs082016.zip")
Response [https://mbsdisclosure.fanniemae.com/disclosure-docs/monthly/mbs082016.zip]
Date: 2016-08-08 02:02
Status: 404
Content-Type: text/html; charset=iso-8859-1
Size: 235 B
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /disclosure-docs/monthly/mbs082016.zip was not found on this server.</p>
</body></html>
Your saved file will have the ending ".zip" no matter what, because that is what you called it, but I wouldn't be surprised if it just a txt file with the error message.
HTH,
-Roy
> On Aug 7, 2016, at 6:42 PM, Glenn Schultz <glennmschultz at me.com> wrote:
>
> paste("https://mbsdisclosure.fanniemae.com/disclosure-docs/monthly/",
> "mbs",
> as.character(Month),
> as.character(Year),
> ".zip",
> sep = "")
> junk <- paste("https://mbsdisclosure.fanniemae.com/disclosure-docs/monthly/",
+ "mbs",
+ as.character(Month),
+ as.character(Year),
+ ".zip",
+ sep = "")
> junk
[1] "https://mbsdisclosure.fanniemae.com/disclosure-docs/monthly/mbs082016.zip"
> httr::GET("https://mbsdisclosure.fanniemae.com/disclosure-docs/monthly/mbs082016.zip")
Response [https://mbsdisclosure.fanniemae.com/disclosure-docs/monthly/mbs082016.zip]
Date: 2016-08-08 02:02
Status: 404
Content-Type: text/html; charset=iso-8859-1
Size: 235 B
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /disclosure-docs/monthly/mbs082016.zip was not found on this server.</p>
</body></html>
**********************
"The contents of this message do not reflect any position of the U.S. Government or NOAA."
**********************
Roy Mendelssohn
Supervisory Operations Research Analyst
NOAA/NMFS
Environmental Research Division
Southwest Fisheries Science Center
***Note new address and phone***
110 Shaffer Road
Santa Cruz, CA 95060
Phone: (831)-420-3666
Fax: (831) 420-3980
e-mail: Roy.Mendelssohn at noaa.gov www: http://www.pfeg.noaa.gov/
"Old age and treachery will overcome youth and skill."
"From those who have been given much, much will be expected"
"the arc of the moral universe is long, but it bends toward justice" -MLK Jr.
More information about the R-help
mailing list