{"action":"created","comment":{"url":"https://api.github.com/repos/webcompat/webcompat.com/pulls/comments/44495910","id":44495910,"diff_hunk":"@@ -368,3 +374,47 @@ def extract_url(issue_body):\n     else:\n         url = \"\"\n     return url\n+\n+\n+def proxy_request(method, path, params=None, headers=None, data=None):\n+    '''Make a GitHub API request with a bot's OAuth token.\n+\n+    Necessary for non-logged in users.\n+    * `path` will be appended to the end of the API_URI.\n+    * Optionally pass in POST data via the `data` arg.\n+    * Optionally point to a different URI via the `uri` arg.\n+    * Optionally pass in HTTP headers to forward.\n+    '''\n+    # Merge passed in headers with AUTH_HEADERS, and add the etag of the\n+    # request, if it exists, to be sent back to GitHub.\n+    auth_headers = AUTH_HEADERS.copy()\n+    if headers:\n+        auth_headers.update(headers)\n+    # Grab the correct Requests request method\n+    req = getattr(requests, method)\n+    # It's expected that path *won't* start with a leading /\n+    # https://api.github.com/repos/{0}\n+    resource_uri = API_URI + path\n+    return req(resource_uri, data=data, params=params, headers=auth_headers)\n+\n+\n+def api_request(method, path, params=None, data=None):\n+    '''Helper to abstract talking to the  GitHub API.\n+\n+    This handles both logged-in and proxied requests.\n+    This returns a tuple, which if returned from a view function will\n+    be automatically turned into a response. But if you return it elsewhere,\n+    pay attention.","path":"webcompat/helpers.py","position":72,"original_position":72,"commit_id":"e6550051d6b2005f75bd6c96df5542ec371206ab","original_commit_id":"e6550051d6b2005f75bd6c96df5542ec371206ab","user":{"login":"karlcow","id":505230,"avatar_url":"https://avatars.githubusercontent.com/u/505230?v=3","gravatar_id":"","url":"https://api.github.com/users/karlcow","html_url":"https://github.com/karlcow","followers_url":"https://api.github.com/users/karlcow/followers","following_url":"https://api.github.com/users/karlcow/following{/other_user}","gists_url":"https://api.github.com/users/karlcow/gists{/gist_id}","starred_url":"https://api.github.com/users/karlcow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karlcow/subscriptions","organizations_url":"https://api.github.com/users/karlcow/orgs","repos_url":"https://api.github.com/users/karlcow/repos","events_url":"https://api.github.com/users/karlcow/events{/privacy}","received_events_url":"https://api.github.com/users/karlcow/received_events","type":"User","site_admin":false},"body":"Could you clarify\r\n> But if you return it elsewhere, pay attention.","created_at":"2015-11-11T02:33:31Z","updated_at":"2015-11-11T02:33:31Z","html_url":"https://github.com/webcompat/webcompat.com/pull/828#discussion_r44495910","pull_request_url":"https://api.github.com/repos/webcompat/webcompat.com/pulls/828","_links":{"self":{"href":"https://api.github.com/repos/webcompat/webcompat.com/pulls/comments/44495910"},"html":{"href":"https://github.com/webcompat/webcompat.com/pull/828#discussion_r44495910"},"pull_request":{"href":"https://api.github.com/repos/webcompat/webcompat.com/pulls/828"}}},"pull_request":{"url":"https://api.github.com/repos/webcompat/webcompat.com/pulls/828","id":50339392,"html_url":"https://github.com/webcompat/webcompat.com/pull/828","diff_url":"https://github.com/webcompat/webcompat.com/pull/828.diff","patch_url":"https://github.com/webcompat/webcompat.com/pull/828.patch","issue_url":"https://api.github.com/repos/webcompat/webcompat.com/issues/828","number":828,"state":"open","locked":false,"title":"Fixes #827. Refactor how we request data from GitHub.","user":{"login":"miketaylr","id":67283,"avatar_url":"https://avatars.githubusercontent.com/u/67283?v=3","gravatar_id":"","url":"https://api.github.com/users/miketaylr","html_url":"https://github.com/miketaylr","followers_url":"https://api.github.com/users/miketaylr/followers","following_url":"https://api.github.com/users/miketaylr/following{/other_user}","gists_url":"https://api.github.com/users/miketaylr/gists{/gist_id}","starred_url":"https://api.github.com/users/miketaylr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miketaylr/subscriptions","organizations_url":"https://api.github.com/users/miketaylr/orgs","repos_url":"https://api.github.com/users/miketaylr/repos","events_url":"https://api.github.com/users/miketaylr/events{/privacy}","received_events_url":"https://api.github.com/users/miketaylr/received_events","type":"User","site_admin":false},"body":"This should pass all tests (at least it does locally!)\r\n\r\nI'm going to do more manual testing and inspection of requests/responses, but it should be ready for review.\r\n\r\nr? @karlcow ","created_at":"2015-11-11T02:02:45Z","updated_at":"2015-11-11T02:33:31Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2a15af7a6ee1aa41fcc72af12164748985198ca9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/webcompat/webcompat.com/pulls/828/commits","review_comments_url":"https://api.github.com/repos/webcompat/webcompat.com/pulls/828/comments","review_comment_url":"https://api.github.com/repos/webcompat/webcompat.com/pulls/comments{/number}","comments_url":"https://api.github.com/repos/webcompat/webcompat.com/issues/828/comments","statuses_url":"https://api.github.com/repos/webcompat/webcompat.com/statuses/e6550051d6b2005f75bd6c96df5542ec371206ab","head":{"label":"webcompat:endpoints-refactor","ref":"endpoints-refactor","sha":"e6550051d6b2005f75bd6c96df5542ec371206ab","user":{"login":"webcompat","id":6175168,"avatar_url":"https://avatars.githubusercontent.com/u/6175168?v=3","gravatar_id":"","url":"https://api.github.com/users/webcompat","html_url":"https://github.com/webcompat","followers_url":"https://api.github.com/users/webcompat/followers","following_url":"https://api.github.com/users/webcompat/following{/other_user}","gists_url":"https://api.github.com/users/webcompat/gists{/gist_id}","starred_url":"https://api.github.com/users/webcompat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webcompat/subscriptions","organizations_url":"https://api.github.com/users/webcompat/orgs","repos_url":"https://api.github.com/users/webcompat/repos","events_url":"https://api.github.com/users/webcompat/events{/privacy}","received_events_url":"https://api.github.com/users/webcompat/received_events","type":"Organization","site_admin":false},"repo":{"id":15174830,"name":"webcompat.com","full_name":"webcompat/webcompat.com","owner":{"login":"webcompat","id":6175168,"avatar_url":"https://avatars.githubusercontent.com/u/6175168?v=3","gravatar_id":"","url":"https://api.github.com/users/webcompat","html_url":"https://github.com/webcompat","followers_url":"https://api.github.com/users/webcompat/followers","following_url":"https://api.github.com/users/webcompat/following{/other_user}","gists_url":"https://api.github.com/users/webcompat/gists{/gist_id}","starred_url":"https://api.github.com/users/webcompat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webcompat/subscriptions","organizations_url":"https://api.github.com/users/webcompat/orgs","repos_url":"https://api.github.com/users/webcompat/repos","events_url":"https://api.github.com/users/webcompat/events{/privacy}","received_events_url":"https://api.github.com/users/webcompat/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/webcompat/webcompat.com","description":"Source code for webcompat.com","fork":false,"url":"https://api.github.com/repos/webcompat/webcompat.com","forks_url":"https://api.github.com/repos/webcompat/webcompat.com/forks","keys_url":"https://api.github.com/repos/webcompat/webcompat.com/keys{/key_id}","collaborators_url":"https://api.github.com/repos/webcompat/webcompat.com/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/webcompat/webcompat.com/teams","hooks_url":"https://api.github.com/repos/webcompat/webcompat.com/hooks","issue_events_url":"https://api.github.com/repos/webcompat/webcompat.com/issues/events{/number}","events_url":"https://api.github.com/repos/webcompat/webcompat.com/events","assignees_url":"https://api.github.com/repos/webcompat/webcompat.com/assignees{/user}","branches_url":"https://api.github.com/repos/webcompat/webcompat.com/branches{/branch}","tags_url":"https://api.github.com/repos/webcompat/webcompat.com/tags","blobs_url":"https://api.github.com/repos/webcompat/webcompat.com/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/webcompat/webcompat.com/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/webcompat/webcompat.com/git/refs{/sha}","trees_url":"https://api.github.com/repos/webcompat/webcompat.com/git/trees{/sha}","statuses_url":"https://api.github.com/repos/webcompat/webcompat.com/statuses/{sha}","languages_url":"https://api.github.com/repos/webcompat/webcompat.com/languages","stargazers_url":"https://api.github.com/repos/webcompat/webcompat.com/stargazers","contributors_url":"https://api.github.com/repos/webcompat/webcompat.com/contributors","subscribers_url":"https://api.github.com/repos/webcompat/webcompat.com/subscribers","subscription_url":"https://api.github.com/repos/webcompat/webcompat.com/subscription","commits_url":"https://api.github.com/repos/webcompat/webcompat.com/commits{/sha}","git_commits_url":"https://api.github.com/repos/webcompat/webcompat.com/git/commits{/sha}","comments_url":"https://api.github.com/repos/webcompat/webcompat.com/comments{/number}","issue_comment_url":"https://api.github.com/repos/webcompat/webcompat.com/issues/comments{/number}","contents_url":"https://api.github.com/repos/webcompat/webcompat.com/contents/{+path}","compare_url":"https://api.github.com/repos/webcompat/webcompat.com/compare/{base}...{head}","merges_url":"https://api.github.com/repos/webcompat/webcompat.com/merges","archive_url":"https://api.github.com/repos/webcompat/webcompat.com/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/webcompat/webcompat.com/downloads","issues_url":"https://api.github.com/repos/webcompat/webcompat.com/issues{/number}","pulls_url":"https://api.github.com/repos/webcompat/webcompat.com/pulls{/number}","milestones_url":"https://api.github.com/repos/webcompat/webcompat.com/milestones{/number}","notifications_url":"https://api.github.com/repos/webcompat/webcompat.com/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/webcompat/webcompat.com/labels{/name}","releases_url":"https://api.github.com/repos/webcompat/webcompat.com/releases{/id}","created_at":"2013-12-13T21:44:40Z","updated_at":"2015-11-08T14:10:26Z","pushed_at":"2015-11-11T02:04:37Z","git_url":"git://github.com/webcompat/webcompat.com.git","ssh_url":"git@github.com:webcompat/webcompat.com.git","clone_url":"https://github.com/webcompat/webcompat.com.git","svn_url":"https://github.com/webcompat/webcompat.com","homepage":null,"size":10807,"stargazers_count":59,"watchers_count":59,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":18,"mirror_url":null,"open_issues_count":100,"forks":18,"open_issues":100,"watchers":59,"default_branch":"master"}},"base":{"label":"webcompat:master","ref":"master","sha":"25f2067389a3adbe48599bb0b03b3dc945786f40","user":{"login":"webcompat","id":6175168,"avatar_url":"https://avatars.githubusercontent.com/u/6175168?v=3","gravatar_id":"","url":"https://api.github.com/users/webcompat","html_url":"https://github.com/webcompat","followers_url":"https://api.github.com/users/webcompat/followers","following_url":"https://api.github.com/users/webcompat/following{/other_user}","gists_url":"https://api.github.com/users/webcompat/gists{/gist_id}","starred_url":"https://api.github.com/users/webcompat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webcompat/subscriptions","organizations_url":"https://api.github.com/users/webcompat/orgs","repos_url":"https://api.github.com/users/webcompat/repos","events_url":"https://api.github.com/users/webcompat/events{/privacy}","received_events_url":"https://api.github.com/users/webcompat/received_events","type":"Organization","site_admin":false},"repo":{"id":15174830,"name":"webcompat.com","full_name":"webcompat/webcompat.com","owner":{"login":"webcompat","id":6175168,"avatar_url":"https://avatars.githubusercontent.com/u/6175168?v=3","gravatar_id":"","url":"https://api.github.com/users/webcompat","html_url":"https://github.com/webcompat","followers_url":"https://api.github.com/users/webcompat/followers","following_url":"https://api.github.com/users/webcompat/following{/other_user}","gists_url":"https://api.github.com/users/webcompat/gists{/gist_id}","starred_url":"https://api.github.com/users/webcompat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/webcompat/subscriptions","organizations_url":"https://api.github.com/users/webcompat/orgs","repos_url":"https://api.github.com/users/webcompat/repos","events_url":"https://api.github.com/users/webcompat/events{/privacy}","received_events_url":"https://api.github.com/users/webcompat/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/webcompat/webcompat.com","description":"Source code for webcompat.com","fork":false,"url":"https://api.github.com/repos/webcompat/webcompat.com","forks_url":"https://api.github.com/repos/webcompat/webcompat.com/forks","keys_url":"https://api.github.com/repos/webcompat/webcompat.com/keys{/key_id}","collaborators_url":"https://api.github.com/repos/webcompat/webcompat.com/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/webcompat/webcompat.com/teams","hooks_url":"https://api.github.com/repos/webcompat/webcompat.com/hooks","issue_events_url":"https://api.github.com/repos/webcompat/webcompat.com/issues/events{/number}","events_url":"https://api.github.com/repos/webcompat/webcompat.com/events","assignees_url":"https://api.github.com/repos/webcompat/webcompat.com/assignees{/user}","branches_url":"https://api.github.com/repos/webcompat/webcompat.com/branches{/branch}","tags_url":"https://api.github.com/repos/webcompat/webcompat.com/tags","blobs_url":"https://api.github.com/repos/webcompat/webcompat.com/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/webcompat/webcompat.com/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/webcompat/webcompat.com/git/refs{/sha}","trees_url":"https://api.github.com/repos/webcompat/webcompat.com/git/trees{/sha}","statuses_url":"https://api.github.com/repos/webcompat/webcompat.com/statuses/{sha}","languages_url":"https://api.github.com/repos/webcompat/webcompat.com/languages","stargazers_url":"https://api.github.com/repos/webcompat/webcompat.com/stargazers","contributors_url":"https://api.github.com/repos/webcompat/webcompat.com/contributors","subscribers_url":"https://api.github.com/repos/webcompat/webcompat.com/subscribers","subscription_url":"https://api.github.com/repos/webcompat/webcompat.com/subscription","commits_url":"https://api.github.com/repos/webcompat/webcompat.com/commits{/sha}","git_commits_url":"https://api.github.com/repos/webcompat/webcompat.com/git/commits{/sha}","comments_url":"https://api.github.com/repos/webcompat/webcompat.com/comments{/number}","issue_comment_url":"https://api.github.com/repos/webcompat/webcompat.com/issues/comments{/number}","contents_url":"https://api.github.com/repos/webcompat/webcompat.com/contents/{+path}","compare_url":"https://api.github.com/repos/webcompat/webcompat.com/compare/{base}...{head}","merges_url":"https://api.github.com/repos/webcompat/webcompat.com/merges","archive_url":"https://api.github.com/repos/webcompat/webcompat.com/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/webcompat/webcompat.com/downloads","issues_url":"https://api.github.com/repos/webcompat/webcompat.com/issues{/number}","pulls_url":"https://api.github.com/repos/webcompat/webcompat.com/pulls{/number}","milestones_url":"https://api.github.com/repos/webcompat/webcompat.com/milestones{/number}","notifications_url":"https://api.github.com/repos/webcompat/webcompat.com/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/webcompat/webcompat.com/labels{/name}","releases_url":"https://api.github.com/repos/webcompat/webcompat.com/releases{/id}","created_at":"2013-12-13T21:44:40Z","updated_at":"2015-11-08T14:10:26Z","pushed_at":"2015-11-11T02:04:37Z","git_url":"git://github.com/webcompat/webcompat.com.git","ssh_url":"git@github.com:webcompat/webcompat.com.git","clone_url":"https://github.com/webcompat/webcompat.com.git","svn_url":"https://github.com/webcompat/webcompat.com","homepage":null,"size":10807,"stargazers_count":59,"watchers_count":59,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":18,"mirror_url":null,"open_issues_count":100,"forks":18,"open_issues":100,"watchers":59,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/webcompat/webcompat.com/pulls/828"},"html":{"href":"https://github.com/webcompat/webcompat.com/pull/828"},"issue":{"href":"https://api.github.com/repos/webcompat/webcompat.com/issues/828"},"comments":{"href":"https://api.github.com/repos/webcompat/webcompat.com/issues/828/comments"},"review_comments":{"href":"https://api.github.com/repos/webcompat/webcompat.com/pulls/828/comments"},"review_comment":{"href":"https://api.github.com/repos/webcompat/webcompat.com/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/webcompat/webcompat.com/pulls/828/commits"},"statuses":{"href":"https://api.github.com/repos/webcompat/webcompat.com/statuses/e6550051d6b2005f75bd6c96df5542ec371206ab"}}}}