R/omdb_api_key&url.r

OMDB_URL="https://www.omdbapi.com/";

omdb_api_key <- function(force = FALSE) {

  env <- Sys.getenv('OMDB_API_KEY')
  if (!identical(env, "") && !force) return(env)

  if (!interactive()) {
    stop("Please set env var OMDB_API_KEY to your OMDB API key",
      call. = FALSE)
  }

  message("Couldn't find env var OMDB_API_KEY.")
  message("Please enter your API key and press enter:")
  code <- readline(": ")

  if (identical(code, "")) {
    stop("OMDB API key entry failed", call. = FALSE)
  }

  message("Updating OMDB_API_KEY env var:")
  Sys.setenv(OMDB_API_KEY = code)

  code

}

Try the imdbapi package in your browser

Any scripts or data that you put into this service are public.

imdbapi documentation built on May 2, 2019, 10:15 a.m.