Fix code climate warnings

This commit is contained in:
Abdelrahman Mahmoud 2017-03-15 13:06:17 -04:00
parent 93df24de39
commit 7324f1f4c7
3 changed files with 6 additions and 6 deletions

View File

@ -134,9 +134,9 @@ class BigQuery(BaseQueryRunner):
key = json.loads(b64decode(self.configuration['jsonKeyFile']))
credentials = ServiceAccountCredentials.from_json_keyfile_dict(key, scope)
creds = ServiceAccountCredentials.from_json_keyfile_dict(key, scope)
http = httplib2.Http(timeout=settings.BIGQUERY_HTTP_TIMEOUT)
http = credentials.authorize(http)
http = creds.authorize(http)
return build("bigquery", "v2", http=http)

View File

@ -81,8 +81,8 @@ class GoogleAnalytics(BaseSQLQueryRunner):
def _get_analytics_service(self):
scope = ['https://www.googleapis.com/auth/analytics.readonly']
key = json.loads(b64decode(self.configuration['jsonKeyFile']))
credentials = ServiceAccountCredentials.from_json_keyfile_dict(key, scope)
return build('analytics', 'v3', http=credentials.authorize(httplib2.Http()))
creds = ServiceAccountCredentials.from_json_keyfile_dict(key, scope)
return build('analytics', 'v3', http=creds.authorize(httplib2.Http()))
def run_query(self, query, user):
logger.debug("Analytics is about to execute query: %s", query)

View File

@ -164,8 +164,8 @@ class GoogleSpreadsheet(BaseQueryRunner):
]
key = json.loads(b64decode(self.configuration['jsonKeyFile']))
credentials = ServiceAccountCredentials.from_json_keyfile_dict(key, scope)
spreadsheetservice = gspread.authorize(credentials)
creds = ServiceAccountCredentials.from_json_keyfile_dict(key, scope)
spreadsheetservice = gspread.authorize(creds)
return spreadsheetservice
def test_connection(self):