Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle error when you try and download file too many times #80

Closed
rabutler-usbr opened this issue Dec 30, 2019 · 2 comments
Closed

handle error when you try and download file too many times #80

rabutler-usbr opened this issue Dec 30, 2019 · 2 comments

Comments

@rabutler-usbr
Copy link
Collaborator

If you try and download a file too many times you receive the following error txt file:

PRISM_tdmean_stable_4kmM3_1970_all_bil_error_msg_10.txt

@rabutler-usbr
Copy link
Collaborator Author

rabutler-usbr commented Jan 10, 2020

RCurl::getURLContent(uri2) returns "application/zip" for a file that can be downloaded and "application/octet-stream" for the text file error message.

However, it uses up 1 of the downloads for the day. Ex: calling it three times will result in the third call returning the error text.


One idea - download as is normally done. If after unzipping the folder, the folder is empty, try renaming the zip folder to .txt, and then try scanning it as a text file. If you get expected text then print the message and delete the folder and zip file.

@rabutler-usbr
Copy link
Collaborator Author

Implemented by using readLines() and checking to see if is PK\003\004, which indicates it's a zip. Otherwise posts warning and returns text that was read in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant