Skip to content
This repository has been archived by the owner on May 10, 2022. It is now read-only.

Issue with fs_embed #80

Closed
karthik opened this issue Apr 17, 2014 · 9 comments
Closed

Issue with fs_embed #80

karthik opened this issue Apr 17, 2014 · 9 comments

Comments

@karthik
Copy link
Contributor

karthik commented Apr 17, 2014

In another thread, @jennybc reports this error with fs_embed.

My attempts to recreate the problem are below:

library(rfigshare)
fs_author_search("Boettiger")
plot(1:10)
dev.print(pdf, "foo.pdf")
fs_embed("foo.pdf")
Your article has been created! Your id number is 1002125
Error in handle_url(handle, url, ...) : 
  Must specify exactly one of url or handle
Calls: fs_embed -> fs_image_url -> GET -> handle_url
@karthik
Copy link
Contributor Author

karthik commented Apr 17, 2014

You're right @jennybc
This does have to do with the fact that there is no doi in fs_image_url. Investigating this further.

@cboettig
Copy link
Collaborator

fs_embed isn't documented because it's not stable yet. Sorry about that,
shouldn't have exported it to the namespace.

fs_image_url requires public images, and it may take some time for the doi
to propagate. As it says in the function docs, it's not really a good
function since the API doesn't support this yet. It's just a HTML scraping
hack. (The only one in the package thankfully).

@karthik I think if anyone is using the ropensci test credentials, the test
files don't get DOIs even when declared "public", since they aren't
actually permanent. (they used to and Mark had to change this). Would
have to check closer to be sure.

On Thu, Apr 17, 2014 at 3:35 PM, Karthik Ram notifications@github.comwrote:

You're right @jennybc https://github.com/jennybc
This does have to do with the fact that there is no doi in fs_image_urlhttps://github.com/ropensci/rfigshare/blob/master/R/fs_embed.R#L13.
Investigating this further.


Reply to this email directly or view it on GitHubhttps://github.com//issues/80#issuecomment-40770534
.

Carl Boettiger
UC Santa Cruz
http://carlboettiger.info/

@karthik
Copy link
Contributor Author

karthik commented Apr 17, 2014

@cboettig Right, I don't think anyone was using the test credentials.
But that reminds me of something. It looks like we're using the app credentials from a test in the package itself. Maybe we should update that to something besides the test credentials?

@cboettig
Copy link
Collaborator

hmm, don't think I follow you. The tests in the package use the test
credentials so that the tests pass on travis, etc.

On Thu, Apr 17, 2014 at 4:04 PM, Karthik Ram notifications@github.comwrote:

@cboettig https://github.com/cboettig Right, I don't think anyone was
using the test credentials.
But that reminds me of something. It looks like we're using the app
credentials from a test in the package itself. Maybe we should update that
to something besides the test credentials?


Reply to this email directly or view it on GitHubhttps://github.com//issues/80#issuecomment-40772378
.

Carl Boettiger
UC Santa Cruz
http://carlboettiger.info/

@karthik
Copy link
Contributor Author

karthik commented Apr 18, 2014

I still use the old auth (passing all credentials). When I tried in dev_mode to replicate this problem, I noticed that the application keys (as Hadley had suggested using) are the test app credentials. Ultimately it doesn't matter but feels like (from an end user perspective) that this is not the final version. Best way to replicate is to clear your local httr cache, and re-authenticate. Look at the application name on the page. Anyway, since it's unrelated to the issue above, closing (but we can continue over email).

@karthik
Copy link
Contributor Author

karthik commented Apr 18, 2014

@jennybc See Carl's response above. TLDR experimental fn, and it will take a while before this is officially exposed on the API.

@karthik karthik closed this as completed Apr 18, 2014
@cboettig
Copy link
Collaborator

@karthik The first two credentials are supposed to be unique to the application, not unique to the user. You can still use them with the private tokens that are user specific. (This also allows the API provider to see how popular a particular application is, rather than treating each user as having there own specific application). @hadley recommended this in issue #72

Users are asked to authenticate if they have no credentials, but can authenticate the old way but with the app credentials by providing the token and private token as function arguments (e.g. as done in the vignette) . The ability to provide a custom key and secret key is really only in fs_auth() for backwards compatibility, and the ability pass token keys manually is really only for the purpose of the automatic unit tests. Authenticating interactively creates a .httr_cache file locally to cache a user's credentials for reuse in and between sessions. A user should never actually need to call fs_auth() themselves.

(just providing this info for completeness sake, even though I guess it's off thread).

@karthik
Copy link
Contributor Author

karthik commented Apr 18, 2014

The first two credentials are supposed to be unique to the application, not unique to the user.

Yes I understand all of this perfectly. The application is called a test application from when it was created.

Also fully understand the rest of the explanation.

@cboettig
Copy link
Collaborator

Oh good point, sorry I misunderstood. Yeah, maybe we should update that.
Feel free to swap in keys for a more appropriately named app or I'll get
around to that sometime


Carl Boettiger
http://carlboettiger.info

sent from mobile device; my apologies for any terseness or typos
On Apr 17, 2014 6:09 PM, "Karthik Ram" notifications@github.com wrote:

The first two credentials are supposed to be unique to the application,
not unique to the user.
Yes I understand all of this perfectly. The application is called a test
application from when it was created.

Also fully understand the rest of the explanation.


Reply to this email directly or view it on GitHubhttps://github.com//issues/80#issuecomment-40778986
.

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

No branches or pull requests

2 participants