Bioconductor / GoogleGenomics

[DEPRECATED] An R package for Google Genomics API queries.
Apache License 2.0
44 stars 23 forks source link

Improve messaging and instructions around authentication. #22

Closed deflaux closed 9 years ago

deflaux commented 10 years ago

Right now the follow message is output upon each package attach, regardless of whether the oauth credentials were cached in a prior session. This can be a bit confusing.

GoogleGenomics: Do not forget to authenticate.
  Use GoogleGenomics::authenticate(file="secretsFile.json").
  See method documentation on how to obtain the secretsFile.

It would be nice if a message like that were output only if needed (e.g., if there are no cached credentials)

Additionally, it would be good to output something similar when a request returns an auth error such as: ERROR: Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.

pgrosu commented 10 years ago

Hi Nicole,

Well, for that to happen the .httr-oauth would need to be stored in a specific place and the "secretsFile.json" will need to always be the same name in order to differentiate it from other files and be recognizable. I posted under #10, a possible start to a solution.

Let me know what you think.

~p

cassiedoll commented 10 years ago

Maybe just catch that specific error from all api calls (which iirc has a specific http code) and tell the user to authenticate then vs upfront?

pgrosu commented 10 years ago

As they say, many roads lead to Rome :) Now it's just a general catch on line 67- 69 of the client.R file, which can be easily augmented.

if("error" %in% names(content(res))) {
  print(paste("ERROR:", content(res)$error[[3]]))
}
deflaux commented 9 years ago

There's more room for improvement, but I think the recent code change does the trick for now.