1

I am very new to MTurkR. I seek to tell MTurkR what my AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are. I tried the code below but used my real keys instead of the fakekey1 and fakekey2 text:

request(operation, GETparameters = NULL,
    keypair = c(Sys.getenv("fakekey1"),  
                Sys.getenv("fakekey2")),
    browser = getOption('MTurkR.browser', FALSE),
    log.requests = getOption('MTurkR.log', TRUE),
    sandbox = getOption('MTurkR.sandbox', FALSE),
    verbose = getOption('MTurkR.verbose', TRUE),
    validation.test = getOption('MTurkR.test', FALSE),
    service = "AWSMechanicalTurkRequester",
    version = NULL)

I get this error: Error in request(operation, GETparameters = NULL, keypair = c(Sys.getenv("fakekey1"), : No keypair provided. Please set environment variables: AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY

Thomas
  • 43,637
  • 12
  • 109
  • 140
user2502904
  • 179
  • 4
  • 13

1 Answers1

1

The best way to set credentials is using environment variables (as the error message indicates and as described in the installation instructions). Specifically, start your script by doing:

Sys.setenv(AWS_ACCESS_KEY_ID = "yourkey")
Sys.setenv(AWS_SECRET_ACCESS_KEY = "yoursecret")
library("MTurkR")

and then run the code on that page. request() will retrieve your keypair automatically from those environment variables.

If for some reason you don't want to set environment variables, you can pass the keypair argument through the ... of any MTurkR function, e.g.:

AccountBalance(keypair = c("yourkey", "yoursecret"))

If you are new to R and unfamiliar with the use of the ... argument in functions, you can see an explanation of it here.

Finally, request() is a low-level function, so there is probably no reason to call it directly.

Community
  • 1
  • 1
Thomas
  • 43,637
  • 12
  • 109
  • 140