{"action":"created","comment":{"url":"https://api.github.com/repos/getredash/redash/pulls/comments/89542149","pull_request_review_id":10088122,"id":89542149,"diff_hunk":"@@ -0,0 +1,136 @@\n+# -*- coding: utf-8 -*-\n+\n+from base64 import b64decode\n+import json\n+import logging\n+from redash.query_runner import *\n+from redash.utils import JSONEncoder\n+from urlparse import urlparse, parse_qs\n+from datetime import datetime\n+logger = logging.getLogger(__name__)\n+\n+try:\n+    import gspread","path":"redash/query_runner/google_analytics.py","position":13,"original_position":13,"commit_id":"92dee61bcd8fb38f5a16d98f03de47f1f4bdfe8c","original_commit_id":"92dee61bcd8fb38f5a16d98f03de47f1f4bdfe8c","user":{"login":"arikfr","id":71468,"avatar_url":"https://avatars.githubusercontent.com/u/71468?v=3","gravatar_id":"","url":"https://api.github.com/users/arikfr","html_url":"https://github.com/arikfr","followers_url":"https://api.github.com/users/arikfr/followers","following_url":"https://api.github.com/users/arikfr/following{/other_user}","gists_url":"https://api.github.com/users/arikfr/gists{/gist_id}","starred_url":"https://api.github.com/users/arikfr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arikfr/subscriptions","organizations_url":"https://api.github.com/users/arikfr/orgs","repos_url":"https://api.github.com/users/arikfr/repos","events_url":"https://api.github.com/users/arikfr/events{/privacy}","received_events_url":"https://api.github.com/users/arikfr/received_events","type":"User","site_admin":false},"body":"you don't need gspread here.","created_at":"2016-11-24T19:52:58Z","updated_at":"2016-11-24T19:52:58Z","html_url":"https://github.com/getredash/redash/pull/1405#discussion_r89542149","pull_request_url":"https://api.github.com/repos/getredash/redash/pulls/1405","_links":{"self":{"href":"https://api.github.com/repos/getredash/redash/pulls/comments/89542149"},"html":{"href":"https://github.com/getredash/redash/pull/1405#discussion_r89542149"},"pull_request":{"href":"https://api.github.com/repos/getredash/redash/pulls/1405"}}},"pull_request":{"url":"https://api.github.com/repos/getredash/redash/pulls/1405","id":94184420,"html_url":"https://github.com/getredash/redash/pull/1405","diff_url":"https://github.com/getredash/redash/pull/1405.diff","patch_url":"https://github.com/getredash/redash/pull/1405.patch","issue_url":"https://api.github.com/repos/getredash/redash/issues/1405","number":1405,"state":"open","locked":false,"title":"[Datasources] Add: simple Google Analytics query runner","user":{"login":"denisov-vlad","id":7091907,"avatar_url":"https://avatars.githubusercontent.com/u/7091907?v=3","gravatar_id":"","url":"https://api.github.com/users/denisov-vlad","html_url":"https://github.com/denisov-vlad","followers_url":"https://api.github.com/users/denisov-vlad/followers","following_url":"https://api.github.com/users/denisov-vlad/following{/other_user}","gists_url":"https://api.github.com/users/denisov-vlad/gists{/gist_id}","starred_url":"https://api.github.com/users/denisov-vlad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denisov-vlad/subscriptions","organizations_url":"https://api.github.com/users/denisov-vlad/orgs","repos_url":"https://api.github.com/users/denisov-vlad/repos","events_url":"https://api.github.com/users/denisov-vlad/events{/privacy}","received_events_url":"https://api.github.com/users/denisov-vlad/received_events","type":"User","site_admin":false},"body":"To get data via this query runner you should copy&paste url from `API Query URI` field on this page:  https://ga-dev-tools.appspot.com/query-explorer/\r\n\r\nfor example:\r\n`https://www.googleapis.com/analytics/v3/data/ga?ids=ga%3A84987497&start-date=2016-09-01&end-date=2016-09-30&metrics=ga%3AnewUsers&dimensions=ga%3AsubContinent&filters=ga%3AsubContinent%3D%3DAustralasia&samplingLevel=HIGHER_PRECISION&max-results=100`","created_at":"2016-11-17T15:04:59Z","updated_at":"2016-11-24T19:57:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6c21d5571892200bec6c87445a57241b9e6cf7a9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/getredash/redash/pulls/1405/commits","review_comments_url":"https://api.github.com/repos/getredash/redash/pulls/1405/comments","review_comment_url":"https://api.github.com/repos/getredash/redash/pulls/comments{/number}","comments_url":"https://api.github.com/repos/getredash/redash/issues/1405/comments","statuses_url":"https://api.github.com/repos/getredash/redash/statuses/92dee61bcd8fb38f5a16d98f03de47f1f4bdfe8c","head":{"label":"denisov-vlad:google_analytics","ref":"google_analytics","sha":"92dee61bcd8fb38f5a16d98f03de47f1f4bdfe8c","user":{"login":"denisov-vlad","id":7091907,"avatar_url":"https://avatars.githubusercontent.com/u/7091907?v=3","gravatar_id":"","url":"https://api.github.com/users/denisov-vlad","html_url":"https://github.com/denisov-vlad","followers_url":"https://api.github.com/users/denisov-vlad/followers","following_url":"https://api.github.com/users/denisov-vlad/following{/other_user}","gists_url":"https://api.github.com/users/denisov-vlad/gists{/gist_id}","starred_url":"https://api.github.com/users/denisov-vlad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denisov-vlad/subscriptions","organizations_url":"https://api.github.com/users/denisov-vlad/orgs","repos_url":"https://api.github.com/users/denisov-vlad/repos","events_url":"https://api.github.com/users/denisov-vlad/events{/privacy}","received_events_url":"https://api.github.com/users/denisov-vlad/received_events","type":"User","site_admin":false},"repo":{"id":74037377,"name":"redash","full_name":"denisov-vlad/redash","owner":{"login":"denisov-vlad","id":7091907,"avatar_url":"https://avatars.githubusercontent.com/u/7091907?v=3","gravatar_id":"","url":"https://api.github.com/users/denisov-vlad","html_url":"https://github.com/denisov-vlad","followers_url":"https://api.github.com/users/denisov-vlad/followers","following_url":"https://api.github.com/users/denisov-vlad/following{/other_user}","gists_url":"https://api.github.com/users/denisov-vlad/gists{/gist_id}","starred_url":"https://api.github.com/users/denisov-vlad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/denisov-vlad/subscriptions","organizations_url":"https://api.github.com/users/denisov-vlad/orgs","repos_url":"https://api.github.com/users/denisov-vlad/repos","events_url":"https://api.github.com/users/denisov-vlad/events{/privacy}","received_events_url":"https://api.github.com/users/denisov-vlad/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/denisov-vlad/redash","description":"Make Your Company Data Driven. Connect to any data source, easily visualize and share your data.","fork":true,"url":"https://api.github.com/repos/denisov-vlad/redash","forks_url":"https://api.github.com/repos/denisov-vlad/redash/forks","keys_url":"https://api.github.com/repos/denisov-vlad/redash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/denisov-vlad/redash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/denisov-vlad/redash/teams","hooks_url":"https://api.github.com/repos/denisov-vlad/redash/hooks","issue_events_url":"https://api.github.com/repos/denisov-vlad/redash/issues/events{/number}","events_url":"https://api.github.com/repos/denisov-vlad/redash/events","assignees_url":"https://api.github.com/repos/denisov-vlad/redash/assignees{/user}","branches_url":"https://api.github.com/repos/denisov-vlad/redash/branches{/branch}","tags_url":"https://api.github.com/repos/denisov-vlad/redash/tags","blobs_url":"https://api.github.com/repos/denisov-vlad/redash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/denisov-vlad/redash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/denisov-vlad/redash/git/refs{/sha}","trees_url":"https://api.github.com/repos/denisov-vlad/redash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/denisov-vlad/redash/statuses/{sha}","languages_url":"https://api.github.com/repos/denisov-vlad/redash/languages","stargazers_url":"https://api.github.com/repos/denisov-vlad/redash/stargazers","contributors_url":"https://api.github.com/repos/denisov-vlad/redash/contributors","subscribers_url":"https://api.github.com/repos/denisov-vlad/redash/subscribers","subscription_url":"https://api.github.com/repos/denisov-vlad/redash/subscription","commits_url":"https://api.github.com/repos/denisov-vlad/redash/commits{/sha}","git_commits_url":"https://api.github.com/repos/denisov-vlad/redash/git/commits{/sha}","comments_url":"https://api.github.com/repos/denisov-vlad/redash/comments{/number}","issue_comment_url":"https://api.github.com/repos/denisov-vlad/redash/issues/comments{/number}","contents_url":"https://api.github.com/repos/denisov-vlad/redash/contents/{+path}","compare_url":"https://api.github.com/repos/denisov-vlad/redash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/denisov-vlad/redash/merges","archive_url":"https://api.github.com/repos/denisov-vlad/redash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/denisov-vlad/redash/downloads","issues_url":"https://api.github.com/repos/denisov-vlad/redash/issues{/number}","pulls_url":"https://api.github.com/repos/denisov-vlad/redash/pulls{/number}","milestones_url":"https://api.github.com/repos/denisov-vlad/redash/milestones{/number}","notifications_url":"https://api.github.com/repos/denisov-vlad/redash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/denisov-vlad/redash/labels{/name}","releases_url":"https://api.github.com/repos/denisov-vlad/redash/releases{/id}","deployments_url":"https://api.github.com/repos/denisov-vlad/redash/deployments","created_at":"2016-11-17T14:57:14Z","updated_at":"2016-11-17T14:57:18Z","pushed_at":"2016-11-23T14:17:21Z","git_url":"git://github.com/denisov-vlad/redash.git","ssh_url":"git@github.com:denisov-vlad/redash.git","clone_url":"https://github.com/denisov-vlad/redash.git","svn_url":"https://github.com/denisov-vlad/redash","homepage":"http://redash.io/","size":7228,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"getredash:master","ref":"master","sha":"2d7a4970737f652105b2fbcfd718ae411e638ec8","user":{"login":"getredash","id":10746780,"avatar_url":"https://avatars.githubusercontent.com/u/10746780?v=3","gravatar_id":"","url":"https://api.github.com/users/getredash","html_url":"https://github.com/getredash","followers_url":"https://api.github.com/users/getredash/followers","following_url":"https://api.github.com/users/getredash/following{/other_user}","gists_url":"https://api.github.com/users/getredash/gists{/gist_id}","starred_url":"https://api.github.com/users/getredash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getredash/subscriptions","organizations_url":"https://api.github.com/users/getredash/orgs","repos_url":"https://api.github.com/users/getredash/repos","events_url":"https://api.github.com/users/getredash/events{/privacy}","received_events_url":"https://api.github.com/users/getredash/received_events","type":"Organization","site_admin":false},"repo":{"id":13926404,"name":"redash","full_name":"getredash/redash","owner":{"login":"getredash","id":10746780,"avatar_url":"https://avatars.githubusercontent.com/u/10746780?v=3","gravatar_id":"","url":"https://api.github.com/users/getredash","html_url":"https://github.com/getredash","followers_url":"https://api.github.com/users/getredash/followers","following_url":"https://api.github.com/users/getredash/following{/other_user}","gists_url":"https://api.github.com/users/getredash/gists{/gist_id}","starred_url":"https://api.github.com/users/getredash/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/getredash/subscriptions","organizations_url":"https://api.github.com/users/getredash/orgs","repos_url":"https://api.github.com/users/getredash/repos","events_url":"https://api.github.com/users/getredash/events{/privacy}","received_events_url":"https://api.github.com/users/getredash/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/getredash/redash","description":"Make Your Company Data Driven. Connect to any data source, easily visualize and share your data.","fork":false,"url":"https://api.github.com/repos/getredash/redash","forks_url":"https://api.github.com/repos/getredash/redash/forks","keys_url":"https://api.github.com/repos/getredash/redash/keys{/key_id}","collaborators_url":"https://api.github.com/repos/getredash/redash/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/getredash/redash/teams","hooks_url":"https://api.github.com/repos/getredash/redash/hooks","issue_events_url":"https://api.github.com/repos/getredash/redash/issues/events{/number}","events_url":"https://api.github.com/repos/getredash/redash/events","assignees_url":"https://api.github.com/repos/getredash/redash/assignees{/user}","branches_url":"https://api.github.com/repos/getredash/redash/branches{/branch}","tags_url":"https://api.github.com/repos/getredash/redash/tags","blobs_url":"https://api.github.com/repos/getredash/redash/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/getredash/redash/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/getredash/redash/git/refs{/sha}","trees_url":"https://api.github.com/repos/getredash/redash/git/trees{/sha}","statuses_url":"https://api.github.com/repos/getredash/redash/statuses/{sha}","languages_url":"https://api.github.com/repos/getredash/redash/languages","stargazers_url":"https://api.github.com/repos/getredash/redash/stargazers","contributors_url":"https://api.github.com/repos/getredash/redash/contributors","subscribers_url":"https://api.github.com/repos/getredash/redash/subscribers","subscription_url":"https://api.github.com/repos/getredash/redash/subscription","commits_url":"https://api.github.com/repos/getredash/redash/commits{/sha}","git_commits_url":"https://api.github.com/repos/getredash/redash/git/commits{/sha}","comments_url":"https://api.github.com/repos/getredash/redash/comments{/number}","issue_comment_url":"https://api.github.com/repos/getredash/redash/issues/comments{/number}","contents_url":"https://api.github.com/repos/getredash/redash/contents/{+path}","compare_url":"https://api.github.com/repos/getredash/redash/compare/{base}...{head}","merges_url":"https://api.github.com/repos/getredash/redash/merges","archive_url":"https://api.github.com/repos/getredash/redash/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/getredash/redash/downloads","issues_url":"https://api.github.com/repos/getredash/redash/issues{/number}","pulls_url":"https://api.github.com/repos/getredash/redash/pulls{/number}","milestones_url":"https://api.github.com/repos/getredash/redash/milestones{/number}","notifications_url":"https://api.github.com/repos/getredash/redash/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/getredash/redash/labels{/name}","releases_url":"https://api.github.com/repos/getredash/redash/releases{/id}","deployments_url":"https://api.github.com/repos/getredash/redash/deployments","created_at":"2013-10-28T13:19:39Z","updated_at":"2016-11-24T10:14:10Z","pushed_at":"2016-11-24T19:52:26Z","git_url":"git://github.com/getredash/redash.git","ssh_url":"git@github.com:getredash/redash.git","clone_url":"https://github.com/getredash/redash.git","svn_url":"https://github.com/getredash/redash","homepage":"http://redash.io/","size":10037,"stargazers_count":2760,"watchers_count":2760,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":522,"mirror_url":null,"open_issues_count":163,"forks":522,"open_issues":163,"watchers":2760,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/getredash/redash/pulls/1405"},"html":{"href":"https://github.com/getredash/redash/pull/1405"},"issue":{"href":"https://api.github.com/repos/getredash/redash/issues/1405"},"comments":{"href":"https://api.github.com/repos/getredash/redash/issues/1405/comments"},"review_comments":{"href":"https://api.github.com/repos/getredash/redash/pulls/1405/comments"},"review_comment":{"href":"https://api.github.com/repos/getredash/redash/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/getredash/redash/pulls/1405/commits"},"statuses":{"href":"https://api.github.com/repos/getredash/redash/statuses/92dee61bcd8fb38f5a16d98f03de47f1f4bdfe8c"}}}}
{"actor":{"display_login":"arikfr"}}