favstats / peRspective

An R wrapper for Conversation AI's Perspective API
https://favstats.github.io/peRspective
Other
53 stars 6 forks source link

Error: Can't pluck from a externalptr #1

Closed AndrewMarritt closed 4 years ago

AndrewMarritt commented 4 years ago

I'm struggling with this issue when trying example code. It seems to occur regardless of whether I use the key in r_environ, or as below.

I've installed peRspective via CRAN.

`library(peRspective) library(tidyverse)

apiKey <- "*****866aed2d8651.json" #real location used

my_text <- "You wrote this? Wow. This is dumb and childish, please go f**** yourself."

text_scores <- prsp_score( text = my_text, languages = "en", score_model = peRspective::prsp_models, key = apiKey )`

favstats commented 4 years ago

Hi! I've never seen that issue and everything is working for me.

However, it looks like you are passing the location of the API key as .json file? Can you just try assigning the API key as a string so it should look something like this:

apiKey <- "AFAKEAPIKEY34565_DFFGF"

AndrewMarritt commented 4 years ago

Thanks. That was the problem.

On the Credentials section of the Perspective API page it only gave two options: OAuth or Service account. However if I went to the page for all APIs it give the option of creating an API key.