{"action":"created","comment":{"url":"https://api.github.com/repos/zulip/zulip/pulls/comments/94305795","pull_request_review_id":14833058,"id":94305795,"diff_hunk":"@@ -0,0 +1,78 @@\n+# See zulip/contrib_bots/lib/readme.md for instructions on running this code.\n+import logging\n+from google import search\n+\n+def get_google_result(original_content):\n+    search_keywords = original_content.split(' ', 1)[1]\n+    if search_keywords == 'help':\n+        help_message = \"To use this bot start message with @google followed \\\n+                        by what you want to search for. If found, Zulip will \\\n+                        return the first search result on Google. An example \\\n+                        message that could be sent is: '@google zulip' or '@google \\\n+                        how to create a chatbot'.\"\n+        return help_message\n+    else:\n+        try:\n+            urls = search(search_keywords, stop=20)\n+        except Exception as e:\n+            logging.exception(e)\n+            return \"Error: search failed. \" + e\n+\n+        if not urls:\n+            return \"No URLs returned by google.\"\n+\n+        url = next(urls)\n+\n+        return 'Success: ' + str(url)","path":"contrib_bots/lib/googlesearch.py","position":26,"original_position":26,"commit_id":"5e4ff8c72d65c971ca661899a9f3a36554834df9","original_commit_id":"5e4ff8c72d65c971ca661899a9f3a36554834df9","user":{"login":"TomaszKolek","id":5993758,"avatar_url":"https://avatars.githubusercontent.com/u/5993758?v=3","gravatar_id":"","url":"https://api.github.com/users/TomaszKolek","html_url":"https://github.com/TomaszKolek","followers_url":"https://api.github.com/users/TomaszKolek/followers","following_url":"https://api.github.com/users/TomaszKolek/following{/other_user}","gists_url":"https://api.github.com/users/TomaszKolek/gists{/gist_id}","starred_url":"https://api.github.com/users/TomaszKolek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/TomaszKolek/subscriptions","organizations_url":"https://api.github.com/users/TomaszKolek/orgs","repos_url":"https://api.github.com/users/TomaszKolek/repos","events_url":"https://api.github.com/users/TomaszKolek/events{/privacy}","received_events_url":"https://api.github.com/users/TomaszKolek/received_events","type":"User","site_admin":false},"body":"Could we use `format` function here?","created_at":"2017-01-02T10:17:23Z","updated_at":"2017-01-02T10:17:23Z","html_url":"https://github.com/zulip/zulip/pull/2772#discussion_r94305795","pull_request_url":"https://api.github.com/repos/zulip/zulip/pulls/2772","_links":{"self":{"href":"https://api.github.com/repos/zulip/zulip/pulls/comments/94305795"},"html":{"href":"https://github.com/zulip/zulip/pull/2772#discussion_r94305795"},"pull_request":{"href":"https://api.github.com/repos/zulip/zulip/pulls/2772"}}},"pull_request":{"url":"https://api.github.com/repos/zulip/zulip/pulls/2772","id":98485588,"html_url":"https://github.com/zulip/zulip/pull/2772","diff_url":"https://github.com/zulip/zulip/pull/2772.diff","patch_url":"https://github.com/zulip/zulip/pull/2772.patch","issue_url":"https://api.github.com/repos/zulip/zulip/issues/2772","number":2772,"state":"open","locked":false,"title":"interactive bots: create google bot.","user":{"login":"royabouhamad","id":19915973,"avatar_url":"https://avatars.githubusercontent.com/u/19915973?v=3","gravatar_id":"","url":"https://api.github.com/users/royabouhamad","html_url":"https://github.com/royabouhamad","followers_url":"https://api.github.com/users/royabouhamad/followers","following_url":"https://api.github.com/users/royabouhamad/following{/other_user}","gists_url":"https://api.github.com/users/royabouhamad/gists{/gist_id}","starred_url":"https://api.github.com/users/royabouhamad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/royabouhamad/subscriptions","organizations_url":"https://api.github.com/users/royabouhamad/orgs","repos_url":"https://api.github.com/users/royabouhamad/repos","events_url":"https://api.github.com/users/royabouhamad/events{/privacy}","received_events_url":"https://api.github.com/users/royabouhamad/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-12-18T20:07:20Z","updated_at":"2017-01-02T10:17:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"020ea82ffd76d1550ac4c02502a7d3f5167389f2","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/zulip/zulip/pulls/2772/commits","review_comments_url":"https://api.github.com/repos/zulip/zulip/pulls/2772/comments","review_comment_url":"https://api.github.com/repos/zulip/zulip/pulls/comments{/number}","comments_url":"https://api.github.com/repos/zulip/zulip/issues/2772/comments","statuses_url":"https://api.github.com/repos/zulip/zulip/statuses/5e4ff8c72d65c971ca661899a9f3a36554834df9","head":{"label":"royabouhamad:task-google-bot","ref":"task-google-bot","sha":"5e4ff8c72d65c971ca661899a9f3a36554834df9","user":{"login":"royabouhamad","id":19915973,"avatar_url":"https://avatars.githubusercontent.com/u/19915973?v=3","gravatar_id":"","url":"https://api.github.com/users/royabouhamad","html_url":"https://github.com/royabouhamad","followers_url":"https://api.github.com/users/royabouhamad/followers","following_url":"https://api.github.com/users/royabouhamad/following{/other_user}","gists_url":"https://api.github.com/users/royabouhamad/gists{/gist_id}","starred_url":"https://api.github.com/users/royabouhamad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/royabouhamad/subscriptions","organizations_url":"https://api.github.com/users/royabouhamad/orgs","repos_url":"https://api.github.com/users/royabouhamad/repos","events_url":"https://api.github.com/users/royabouhamad/events{/privacy}","received_events_url":"https://api.github.com/users/royabouhamad/received_events","type":"User","site_admin":false},"repo":{"id":75874447,"name":"zulip","full_name":"royabouhamad/zulip","owner":{"login":"royabouhamad","id":19915973,"avatar_url":"https://avatars.githubusercontent.com/u/19915973?v=3","gravatar_id":"","url":"https://api.github.com/users/royabouhamad","html_url":"https://github.com/royabouhamad","followers_url":"https://api.github.com/users/royabouhamad/followers","following_url":"https://api.github.com/users/royabouhamad/following{/other_user}","gists_url":"https://api.github.com/users/royabouhamad/gists{/gist_id}","starred_url":"https://api.github.com/users/royabouhamad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/royabouhamad/subscriptions","organizations_url":"https://api.github.com/users/royabouhamad/orgs","repos_url":"https://api.github.com/users/royabouhamad/repos","events_url":"https://api.github.com/users/royabouhamad/events{/privacy}","received_events_url":"https://api.github.com/users/royabouhamad/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/royabouhamad/zulip","description":"Zulip server - powerful open source group chat","fork":true,"url":"https://api.github.com/repos/royabouhamad/zulip","forks_url":"https://api.github.com/repos/royabouhamad/zulip/forks","keys_url":"https://api.github.com/repos/royabouhamad/zulip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/royabouhamad/zulip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/royabouhamad/zulip/teams","hooks_url":"https://api.github.com/repos/royabouhamad/zulip/hooks","issue_events_url":"https://api.github.com/repos/royabouhamad/zulip/issues/events{/number}","events_url":"https://api.github.com/repos/royabouhamad/zulip/events","assignees_url":"https://api.github.com/repos/royabouhamad/zulip/assignees{/user}","branches_url":"https://api.github.com/repos/royabouhamad/zulip/branches{/branch}","tags_url":"https://api.github.com/repos/royabouhamad/zulip/tags","blobs_url":"https://api.github.com/repos/royabouhamad/zulip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/royabouhamad/zulip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/royabouhamad/zulip/git/refs{/sha}","trees_url":"https://api.github.com/repos/royabouhamad/zulip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/royabouhamad/zulip/statuses/{sha}","languages_url":"https://api.github.com/repos/royabouhamad/zulip/languages","stargazers_url":"https://api.github.com/repos/royabouhamad/zulip/stargazers","contributors_url":"https://api.github.com/repos/royabouhamad/zulip/contributors","subscribers_url":"https://api.github.com/repos/royabouhamad/zulip/subscribers","subscription_url":"https://api.github.com/repos/royabouhamad/zulip/subscription","commits_url":"https://api.github.com/repos/royabouhamad/zulip/commits{/sha}","git_commits_url":"https://api.github.com/repos/royabouhamad/zulip/git/commits{/sha}","comments_url":"https://api.github.com/repos/royabouhamad/zulip/comments{/number}","issue_comment_url":"https://api.github.com/repos/royabouhamad/zulip/issues/comments{/number}","contents_url":"https://api.github.com/repos/royabouhamad/zulip/contents/{+path}","compare_url":"https://api.github.com/repos/royabouhamad/zulip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/royabouhamad/zulip/merges","archive_url":"https://api.github.com/repos/royabouhamad/zulip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/royabouhamad/zulip/downloads","issues_url":"https://api.github.com/repos/royabouhamad/zulip/issues{/number}","pulls_url":"https://api.github.com/repos/royabouhamad/zulip/pulls{/number}","milestones_url":"https://api.github.com/repos/royabouhamad/zulip/milestones{/number}","notifications_url":"https://api.github.com/repos/royabouhamad/zulip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/royabouhamad/zulip/labels{/name}","releases_url":"https://api.github.com/repos/royabouhamad/zulip/releases{/id}","deployments_url":"https://api.github.com/repos/royabouhamad/zulip/deployments","created_at":"2016-12-07T20:48:48Z","updated_at":"2016-12-07T20:48:56Z","pushed_at":"2016-12-31T15:59:05Z","git_url":"git://github.com/royabouhamad/zulip.git","ssh_url":"git@github.com:royabouhamad/zulip.git","clone_url":"https://github.com/royabouhamad/zulip.git","svn_url":"https://github.com/royabouhamad/zulip","homepage":"","size":130751,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"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":"zulip:master","ref":"master","sha":"ec3e5e844a83c04319f039ba339defe46059d00f","user":{"login":"zulip","id":4921959,"avatar_url":"https://avatars.githubusercontent.com/u/4921959?v=3","gravatar_id":"","url":"https://api.github.com/users/zulip","html_url":"https://github.com/zulip","followers_url":"https://api.github.com/users/zulip/followers","following_url":"https://api.github.com/users/zulip/following{/other_user}","gists_url":"https://api.github.com/users/zulip/gists{/gist_id}","starred_url":"https://api.github.com/users/zulip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zulip/subscriptions","organizations_url":"https://api.github.com/users/zulip/orgs","repos_url":"https://api.github.com/users/zulip/repos","events_url":"https://api.github.com/users/zulip/events{/privacy}","received_events_url":"https://api.github.com/users/zulip/received_events","type":"Organization","site_admin":false},"repo":{"id":43160685,"name":"zulip","full_name":"zulip/zulip","owner":{"login":"zulip","id":4921959,"avatar_url":"https://avatars.githubusercontent.com/u/4921959?v=3","gravatar_id":"","url":"https://api.github.com/users/zulip","html_url":"https://github.com/zulip","followers_url":"https://api.github.com/users/zulip/followers","following_url":"https://api.github.com/users/zulip/following{/other_user}","gists_url":"https://api.github.com/users/zulip/gists{/gist_id}","starred_url":"https://api.github.com/users/zulip/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zulip/subscriptions","organizations_url":"https://api.github.com/users/zulip/orgs","repos_url":"https://api.github.com/users/zulip/repos","events_url":"https://api.github.com/users/zulip/events{/privacy}","received_events_url":"https://api.github.com/users/zulip/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/zulip/zulip","description":"Zulip server - powerful open source group chat","fork":false,"url":"https://api.github.com/repos/zulip/zulip","forks_url":"https://api.github.com/repos/zulip/zulip/forks","keys_url":"https://api.github.com/repos/zulip/zulip/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zulip/zulip/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zulip/zulip/teams","hooks_url":"https://api.github.com/repos/zulip/zulip/hooks","issue_events_url":"https://api.github.com/repos/zulip/zulip/issues/events{/number}","events_url":"https://api.github.com/repos/zulip/zulip/events","assignees_url":"https://api.github.com/repos/zulip/zulip/assignees{/user}","branches_url":"https://api.github.com/repos/zulip/zulip/branches{/branch}","tags_url":"https://api.github.com/repos/zulip/zulip/tags","blobs_url":"https://api.github.com/repos/zulip/zulip/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zulip/zulip/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zulip/zulip/git/refs{/sha}","trees_url":"https://api.github.com/repos/zulip/zulip/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zulip/zulip/statuses/{sha}","languages_url":"https://api.github.com/repos/zulip/zulip/languages","stargazers_url":"https://api.github.com/repos/zulip/zulip/stargazers","contributors_url":"https://api.github.com/repos/zulip/zulip/contributors","subscribers_url":"https://api.github.com/repos/zulip/zulip/subscribers","subscription_url":"https://api.github.com/repos/zulip/zulip/subscription","commits_url":"https://api.github.com/repos/zulip/zulip/commits{/sha}","git_commits_url":"https://api.github.com/repos/zulip/zulip/git/commits{/sha}","comments_url":"https://api.github.com/repos/zulip/zulip/comments{/number}","issue_comment_url":"https://api.github.com/repos/zulip/zulip/issues/comments{/number}","contents_url":"https://api.github.com/repos/zulip/zulip/contents/{+path}","compare_url":"https://api.github.com/repos/zulip/zulip/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zulip/zulip/merges","archive_url":"https://api.github.com/repos/zulip/zulip/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zulip/zulip/downloads","issues_url":"https://api.github.com/repos/zulip/zulip/issues{/number}","pulls_url":"https://api.github.com/repos/zulip/zulip/pulls{/number}","milestones_url":"https://api.github.com/repos/zulip/zulip/milestones{/number}","notifications_url":"https://api.github.com/repos/zulip/zulip/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zulip/zulip/labels{/name}","releases_url":"https://api.github.com/repos/zulip/zulip/releases{/id}","deployments_url":"https://api.github.com/repos/zulip/zulip/deployments","created_at":"2015-09-25T16:37:25Z","updated_at":"2017-01-02T06:54:42Z","pushed_at":"2017-01-02T09:30:53Z","git_url":"git://github.com/zulip/zulip.git","ssh_url":"git@github.com:zulip/zulip.git","clone_url":"https://github.com/zulip/zulip.git","svn_url":"https://github.com/zulip/zulip","homepage":"","size":132590,"stargazers_count":4355,"watchers_count":4355,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":955,"mirror_url":null,"open_issues_count":673,"forks":955,"open_issues":673,"watchers":4355,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/zulip/zulip/pulls/2772"},"html":{"href":"https://github.com/zulip/zulip/pull/2772"},"issue":{"href":"https://api.github.com/repos/zulip/zulip/issues/2772"},"comments":{"href":"https://api.github.com/repos/zulip/zulip/issues/2772/comments"},"review_comments":{"href":"https://api.github.com/repos/zulip/zulip/pulls/2772/comments"},"review_comment":{"href":"https://api.github.com/repos/zulip/zulip/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/zulip/zulip/pulls/2772/commits"},"statuses":{"href":"https://api.github.com/repos/zulip/zulip/statuses/5e4ff8c72d65c971ca661899a9f3a36554834df9"}}}}
{"actor":{"display_login":"TomaszKolek"}}