<div dir="ltr">Just few more things which might help:<div><br></div><div><div>λ res ^. responseStatus</div><div>Status {statusCode = 200, statusMessage = "OK"}</div><div>λ :t res ^. responseStatus</div><div>res ^. responseStatus :: Status</div><div>λ :i Status</div><div>data Status</div><div>  = Network.HTTP.Types.Status.Status {Network.HTTP.Types.Status.statusCode :: Int,</div><div>                                      Network.HTTP.Types.Status.statusMessage :: Data.ByteString.Internal.ByteString}</div><div>        -- Defined in ‘Network.HTTP.Types.Status’</div><div>instance Enum Status -- Defined in ‘Network.HTTP.Types.Status’</div><div>instance Eq Status -- Defined in ‘Network.HTTP.Types.Status’</div><div>instance Ord Status -- Defined in ‘Network.HTTP.Types.Status’</div><div>instance Show Status -- Defined in ‘Network.HTTP.Types.Status’</div></div><div><br></div><div>You can see how to get the status, where it comes from. So you can just do "if res ^. responseStatus /= status200 then ...".</div><div><br></div><div>Cheers.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sun, Oct 4, 2015 at 6:18 PM, Mike Houghton <span dir="ltr"><<a href="mailto:mike_k_houghton@yahoo.co.uk" target="_blank">mike_k_houghton@yahoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
Please can someone explain how,using the wreq package, I can download and save a binary file?<br>
Say the file is at the end of<br>
<a href="http://x.y.z/files/myfile.jpg" rel="noreferrer" target="_blank">http://x.y.z/files/myfile.jpg</a><br>
<br>
and it is a jpeg and no authentication is needed.<br>
<br>
I just want to<br>
<br>
1. Check that the URL is syntactically correct - flag and error if not<br>
2. If the URL is syntactically ok then download the file using GET.<br>
3. Check that the response code is 200 and if so save the file<br>
3a. if the response code is not 200 then delegate to an  error handling function or some simple idiomatic way of error handling.<br>
<br>
<br>
Thanks once again.<br>
<br>
Mike<br>
<br>
_______________________________________________<br>
Beginners mailing list<br>
<a href="mailto:Beginners@haskell.org">Beginners@haskell.org</a><br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners</a><br>
</blockquote></div><br></div>