Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for reading API keys from an env var. #49

Merged
merged 1 commit into from Apr 29, 2015

Conversation

@craigcitro
Copy link
Collaborator

commented Apr 29, 2015

This adds support for API keys to bigrquery, reading them from the
BIGRQUERY_API_KEY environment variable. They're used in all API calls when
present.

PTAL @hadley

R/request.r Outdated
@@ -1,30 +1,47 @@
base_url <- "https://www.googleapis.com/bigquery/v2/"
upload_url <- "https://www.googleapis.com/upload/bigquery/v2/"

prepare_bq_query <- function(query) {
api_key <- Sys.getenv("BIGRQUERY_API_KEY")
if (nzchar(api_key)) {

This comment has been minimized.

Copy link
@hadley

hadley Apr 29, 2015

Member

Tiny niggles: I think this would be easier to understand if you did if (!nzchar(api_key)) return(query) etc

This comment has been minimized.

Copy link
@craigcitro

craigcitro Apr 29, 2015

Author Collaborator

done -- in fact, shortened a good bit when i remembered %||%.

feel free to spot more niggles. 😏

@craigcitro craigcitro force-pushed the craigcitro:api_keys branch from 732b42f to b4a302a Apr 29, 2015

@craigcitro

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 29, 2015

PTAL

@hadley

This comment has been minimized.

Copy link
Member

commented Apr 29, 2015

YEEEEESSSS.

(Can you please add a bullet point to news before merging?)

Add support for reading API keys from an env var.
This adds support for API keys to bigrquery, reading them from the
`BIGRQUERY_API_KEY` environment variable. They're used in all API calls when
present.

@craigcitro craigcitro force-pushed the craigcitro:api_keys branch from b4a302a to 7cef78b Apr 29, 2015

@craigcitro craigcitro merged commit 7cef78b into r-dbi:master Apr 29, 2015

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@SantoshSrinivas79

This comment has been minimized.

Copy link

commented Jan 5, 2016

@craigcitro is this been merged? for some reason i am unable to use big query and it still asks for browser authentication.

I am setting the env variable as below.

Sys.setenv(BIGRQUERY_API_KEY="TuxYqUc3eVzkllXnMHbk2iIZSp6wZASkj9nNsDkyX")
@byapparov

This comment has been minimized.

Copy link
Contributor

commented Oct 6, 2016

Where BIGRQUERY_API_KEY can be found in the Google API Console? Is it the only environment variable required for access to bigquery?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.