-
Notifications
You must be signed in to change notification settings - Fork 3
Make authentication optional for endpoints that don't require it? #9
Comments
hi @Thercast , thanks for the issue. the problem is that the functions so your proposed setup i think wouldn't work when an api key and username are in fact required AND when the user has set key and username as either env vars or R options instead of passing in as args. |
Thanks for the feedback! If we can safely assume that the results returned for the aforementioned endpoints are the same with or without credentials, then it might make more sense to simply use |
I checked to see what the Ruby gem does - it sends credentials if the user supplies them, even if the route doesn't need credentials. I agree with this for the primary reason that it's just less complex I think the way forward is to not on this request https://discuss.ropensci.org/topics/private-messages/sckott.json?api_key=asdf&api_username=asdf we get {
"errors": [
"You are not permitted to view the requested resource."
],
"error_type": "invalid_access"
} not passing this on right now, but can add that |
i've pushed some changes, make sure to sync upstream before PR |
I've been inspired by the new RStudio community portal (powered by discourse) to leverage the discourse API for scraping posts and other information, and luckily I found your package! When reviewing the API documentation and doing some quick trial and error, I noticed that a few of the endpoints do not require an API key nor user name. Within
discgolf
I verified that the following functions could in fact run just as well without thekey
oruser
parameters specified:categories
,category
,category_latest_topics
,category_top_topics
,tag
,topics_latest
,topics_new
, andtopics_by
. For these functions I made a slight modification (along with a new utility function) to bypass using thedc
function if the user does not specifyuser
andkey
. For example here's a revised version oftopics_latest
and the new functionuse_auth
in action:Does this sound like a reasonable approach? I'm happy to make updates and would be glad to send a PR if you find it useful.
The text was updated successfully, but these errors were encountered: