{"action":"created","comment":{"url":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/comments/55844612","id":55844612,"diff_hunk":"@@ -38,6 +38,26 @@ def _update_attributes(self, branch):\n     def _repr(self):\n         return '<Repository Branch [{0}]>'.format(self.name)\n \n+    def latest_sha(self, differs_from=''):\n+        \"\"\"Check if SHA-1 is the same as remote branch\n+\n+        See: https://git.io/vaqIw\n+\n+        :param differs_from string: (optional), sha to compare against\n+        :returns: strring of the SHA or None\n+        \"\"\"\n+        # If-None-Match returns 200 instead of 304 value does not have quotes\n+        headers = {\n+            'Accept': 'application/vnd.github.chitauri-preview+sha',\n+            'If-None-Match': '\"{0}\"'.format(differs_from)\n+        }\n+        base = self._api.split('/branches', 1)[0]\n+        url = self._build_url('commits', self.name, base_url=base)\n+        resp = self._get(url, headers=headers)\n+        if resp:","path":"github3/repos/branch.py","position":20,"original_position":20,"commit_id":"04c549c9104a98e3b1e9929fe3f402fa01a8bea6","original_commit_id":"04c549c9104a98e3b1e9929fe3f402fa01a8bea6","user":{"login":"itsmemattchung","id":7358102,"avatar_url":"https://avatars.githubusercontent.com/u/7358102?v=3","gravatar_id":"","url":"https://api.github.com/users/itsmemattchung","html_url":"https://github.com/itsmemattchung","followers_url":"https://api.github.com/users/itsmemattchung/followers","following_url":"https://api.github.com/users/itsmemattchung/following{/other_user}","gists_url":"https://api.github.com/users/itsmemattchung/gists{/gist_id}","starred_url":"https://api.github.com/users/itsmemattchung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itsmemattchung/subscriptions","organizations_url":"https://api.github.com/users/itsmemattchung/orgs","repos_url":"https://api.github.com/users/itsmemattchung/repos","events_url":"https://api.github.com/users/itsmemattchung/events{/privacy}","received_events_url":"https://api.github.com/users/itsmemattchung/received_events","type":"User","site_admin":false},"body":"> This could be more simply:\r\n> \r\n> if resp and self._boolean(resp, 304, 200):\r\n>     return resp.content\r\n> return None\r\n> Also, I think _get will never return anything other than a requests Response so I don't think we need to check for its truthy-ness here.\r\n\r\nI felt this was a bit awkward - thanks for pointing it out.","created_at":"2016-03-11T15:36:40Z","updated_at":"2016-03-11T15:36:40Z","html_url":"https://github.com/sigmavirus24/github3.py/pull/587#discussion_r55844612","pull_request_url":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/587","_links":{"self":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/comments/55844612"},"html":{"href":"https://github.com/sigmavirus24/github3.py/pull/587#discussion_r55844612"},"pull_request":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/587"}}},"pull_request":{"url":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/587","id":62508493,"html_url":"https://github.com/sigmavirus24/github3.py/pull/587","diff_url":"https://github.com/sigmavirus24/github3.py/pull/587.diff","patch_url":"https://github.com/sigmavirus24/github3.py/pull/587.patch","issue_url":"https://api.github.com/repos/sigmavirus24/github3.py/issues/587","number":587,"state":"open","locked":false,"title":"Initial commit for issues/585.","user":{"login":"itsmemattchung","id":7358102,"avatar_url":"https://avatars.githubusercontent.com/u/7358102?v=3","gravatar_id":"","url":"https://api.github.com/users/itsmemattchung","html_url":"https://github.com/itsmemattchung","followers_url":"https://api.github.com/users/itsmemattchung/followers","following_url":"https://api.github.com/users/itsmemattchung/following{/other_user}","gists_url":"https://api.github.com/users/itsmemattchung/gists{/gist_id}","starred_url":"https://api.github.com/users/itsmemattchung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itsmemattchung/subscriptions","organizations_url":"https://api.github.com/users/itsmemattchung/orgs","repos_url":"https://api.github.com/users/itsmemattchung/repos","events_url":"https://api.github.com/users/itsmemattchung/events{/privacy}","received_events_url":"https://api.github.com/users/itsmemattchung/received_events","type":"User","site_admin":false},"body":"Resolves https://github.com/sigmavirus24/github3.py/issues/585\r\n\r\nThis reduces user rate limiting when a 304 response is returned","created_at":"2016-03-11T07:51:54Z","updated_at":"2016-03-11T15:36:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b0b25721e2ee44ff377bfde52b54bda59f692af9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/587/commits","review_comments_url":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/587/comments","review_comment_url":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sigmavirus24/github3.py/issues/587/comments","statuses_url":"https://api.github.com/repos/sigmavirus24/github3.py/statuses/04c549c9104a98e3b1e9929fe3f402fa01a8bea6","head":{"label":"itsmemattchung:issues/585","ref":"issues/585","sha":"04c549c9104a98e3b1e9929fe3f402fa01a8bea6","user":{"login":"itsmemattchung","id":7358102,"avatar_url":"https://avatars.githubusercontent.com/u/7358102?v=3","gravatar_id":"","url":"https://api.github.com/users/itsmemattchung","html_url":"https://github.com/itsmemattchung","followers_url":"https://api.github.com/users/itsmemattchung/followers","following_url":"https://api.github.com/users/itsmemattchung/following{/other_user}","gists_url":"https://api.github.com/users/itsmemattchung/gists{/gist_id}","starred_url":"https://api.github.com/users/itsmemattchung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itsmemattchung/subscriptions","organizations_url":"https://api.github.com/users/itsmemattchung/orgs","repos_url":"https://api.github.com/users/itsmemattchung/repos","events_url":"https://api.github.com/users/itsmemattchung/events{/privacy}","received_events_url":"https://api.github.com/users/itsmemattchung/received_events","type":"User","site_admin":false},"repo":{"id":43913126,"name":"github3.py","full_name":"itsmemattchung/github3.py","owner":{"login":"itsmemattchung","id":7358102,"avatar_url":"https://avatars.githubusercontent.com/u/7358102?v=3","gravatar_id":"","url":"https://api.github.com/users/itsmemattchung","html_url":"https://github.com/itsmemattchung","followers_url":"https://api.github.com/users/itsmemattchung/followers","following_url":"https://api.github.com/users/itsmemattchung/following{/other_user}","gists_url":"https://api.github.com/users/itsmemattchung/gists{/gist_id}","starred_url":"https://api.github.com/users/itsmemattchung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itsmemattchung/subscriptions","organizations_url":"https://api.github.com/users/itsmemattchung/orgs","repos_url":"https://api.github.com/users/itsmemattchung/repos","events_url":"https://api.github.com/users/itsmemattchung/events{/privacy}","received_events_url":"https://api.github.com/users/itsmemattchung/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/itsmemattchung/github3.py","description":"Python library for interfacing with the GitHub APIv3","fork":true,"url":"https://api.github.com/repos/itsmemattchung/github3.py","forks_url":"https://api.github.com/repos/itsmemattchung/github3.py/forks","keys_url":"https://api.github.com/repos/itsmemattchung/github3.py/keys{/key_id}","collaborators_url":"https://api.github.com/repos/itsmemattchung/github3.py/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/itsmemattchung/github3.py/teams","hooks_url":"https://api.github.com/repos/itsmemattchung/github3.py/hooks","issue_events_url":"https://api.github.com/repos/itsmemattchung/github3.py/issues/events{/number}","events_url":"https://api.github.com/repos/itsmemattchung/github3.py/events","assignees_url":"https://api.github.com/repos/itsmemattchung/github3.py/assignees{/user}","branches_url":"https://api.github.com/repos/itsmemattchung/github3.py/branches{/branch}","tags_url":"https://api.github.com/repos/itsmemattchung/github3.py/tags","blobs_url":"https://api.github.com/repos/itsmemattchung/github3.py/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/itsmemattchung/github3.py/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/itsmemattchung/github3.py/git/refs{/sha}","trees_url":"https://api.github.com/repos/itsmemattchung/github3.py/git/trees{/sha}","statuses_url":"https://api.github.com/repos/itsmemattchung/github3.py/statuses/{sha}","languages_url":"https://api.github.com/repos/itsmemattchung/github3.py/languages","stargazers_url":"https://api.github.com/repos/itsmemattchung/github3.py/stargazers","contributors_url":"https://api.github.com/repos/itsmemattchung/github3.py/contributors","subscribers_url":"https://api.github.com/repos/itsmemattchung/github3.py/subscribers","subscription_url":"https://api.github.com/repos/itsmemattchung/github3.py/subscription","commits_url":"https://api.github.com/repos/itsmemattchung/github3.py/commits{/sha}","git_commits_url":"https://api.github.com/repos/itsmemattchung/github3.py/git/commits{/sha}","comments_url":"https://api.github.com/repos/itsmemattchung/github3.py/comments{/number}","issue_comment_url":"https://api.github.com/repos/itsmemattchung/github3.py/issues/comments{/number}","contents_url":"https://api.github.com/repos/itsmemattchung/github3.py/contents/{+path}","compare_url":"https://api.github.com/repos/itsmemattchung/github3.py/compare/{base}...{head}","merges_url":"https://api.github.com/repos/itsmemattchung/github3.py/merges","archive_url":"https://api.github.com/repos/itsmemattchung/github3.py/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/itsmemattchung/github3.py/downloads","issues_url":"https://api.github.com/repos/itsmemattchung/github3.py/issues{/number}","pulls_url":"https://api.github.com/repos/itsmemattchung/github3.py/pulls{/number}","milestones_url":"https://api.github.com/repos/itsmemattchung/github3.py/milestones{/number}","notifications_url":"https://api.github.com/repos/itsmemattchung/github3.py/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/itsmemattchung/github3.py/labels{/name}","releases_url":"https://api.github.com/repos/itsmemattchung/github3.py/releases{/id}","deployments_url":"https://api.github.com/repos/itsmemattchung/github3.py/deployments","created_at":"2015-10-08T19:57:30Z","updated_at":"2016-01-13T04:32:42Z","pushed_at":"2016-03-11T11:30:33Z","git_url":"git://github.com/itsmemattchung/github3.py.git","ssh_url":"git@github.com:itsmemattchung/github3.py.git","clone_url":"https://github.com/itsmemattchung/github3.py.git","svn_url":"https://github.com/itsmemattchung/github3.py","homepage":"http://github3py.readthedocs.org/","size":7758,"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":"develop"}},"base":{"label":"sigmavirus24:develop","ref":"develop","sha":"872c813ffb7a40c96c3252d764e4838444905ad9","user":{"login":"sigmavirus24","id":240830,"avatar_url":"https://avatars.githubusercontent.com/u/240830?v=3","gravatar_id":"","url":"https://api.github.com/users/sigmavirus24","html_url":"https://github.com/sigmavirus24","followers_url":"https://api.github.com/users/sigmavirus24/followers","following_url":"https://api.github.com/users/sigmavirus24/following{/other_user}","gists_url":"https://api.github.com/users/sigmavirus24/gists{/gist_id}","starred_url":"https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sigmavirus24/subscriptions","organizations_url":"https://api.github.com/users/sigmavirus24/orgs","repos_url":"https://api.github.com/users/sigmavirus24/repos","events_url":"https://api.github.com/users/sigmavirus24/events{/privacy}","received_events_url":"https://api.github.com/users/sigmavirus24/received_events","type":"User","site_admin":false},"repo":{"id":3710711,"name":"github3.py","full_name":"sigmavirus24/github3.py","owner":{"login":"sigmavirus24","id":240830,"avatar_url":"https://avatars.githubusercontent.com/u/240830?v=3","gravatar_id":"","url":"https://api.github.com/users/sigmavirus24","html_url":"https://github.com/sigmavirus24","followers_url":"https://api.github.com/users/sigmavirus24/followers","following_url":"https://api.github.com/users/sigmavirus24/following{/other_user}","gists_url":"https://api.github.com/users/sigmavirus24/gists{/gist_id}","starred_url":"https://api.github.com/users/sigmavirus24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sigmavirus24/subscriptions","organizations_url":"https://api.github.com/users/sigmavirus24/orgs","repos_url":"https://api.github.com/users/sigmavirus24/repos","events_url":"https://api.github.com/users/sigmavirus24/events{/privacy}","received_events_url":"https://api.github.com/users/sigmavirus24/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/sigmavirus24/github3.py","description":"Python library for interfacing with the GitHub APIv3","fork":false,"url":"https://api.github.com/repos/sigmavirus24/github3.py","forks_url":"https://api.github.com/repos/sigmavirus24/github3.py/forks","keys_url":"https://api.github.com/repos/sigmavirus24/github3.py/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sigmavirus24/github3.py/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sigmavirus24/github3.py/teams","hooks_url":"https://api.github.com/repos/sigmavirus24/github3.py/hooks","issue_events_url":"https://api.github.com/repos/sigmavirus24/github3.py/issues/events{/number}","events_url":"https://api.github.com/repos/sigmavirus24/github3.py/events","assignees_url":"https://api.github.com/repos/sigmavirus24/github3.py/assignees{/user}","branches_url":"https://api.github.com/repos/sigmavirus24/github3.py/branches{/branch}","tags_url":"https://api.github.com/repos/sigmavirus24/github3.py/tags","blobs_url":"https://api.github.com/repos/sigmavirus24/github3.py/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sigmavirus24/github3.py/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sigmavirus24/github3.py/git/refs{/sha}","trees_url":"https://api.github.com/repos/sigmavirus24/github3.py/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sigmavirus24/github3.py/statuses/{sha}","languages_url":"https://api.github.com/repos/sigmavirus24/github3.py/languages","stargazers_url":"https://api.github.com/repos/sigmavirus24/github3.py/stargazers","contributors_url":"https://api.github.com/repos/sigmavirus24/github3.py/contributors","subscribers_url":"https://api.github.com/repos/sigmavirus24/github3.py/subscribers","subscription_url":"https://api.github.com/repos/sigmavirus24/github3.py/subscription","commits_url":"https://api.github.com/repos/sigmavirus24/github3.py/commits{/sha}","git_commits_url":"https://api.github.com/repos/sigmavirus24/github3.py/git/commits{/sha}","comments_url":"https://api.github.com/repos/sigmavirus24/github3.py/comments{/number}","issue_comment_url":"https://api.github.com/repos/sigmavirus24/github3.py/issues/comments{/number}","contents_url":"https://api.github.com/repos/sigmavirus24/github3.py/contents/{+path}","compare_url":"https://api.github.com/repos/sigmavirus24/github3.py/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sigmavirus24/github3.py/merges","archive_url":"https://api.github.com/repos/sigmavirus24/github3.py/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sigmavirus24/github3.py/downloads","issues_url":"https://api.github.com/repos/sigmavirus24/github3.py/issues{/number}","pulls_url":"https://api.github.com/repos/sigmavirus24/github3.py/pulls{/number}","milestones_url":"https://api.github.com/repos/sigmavirus24/github3.py/milestones{/number}","notifications_url":"https://api.github.com/repos/sigmavirus24/github3.py/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sigmavirus24/github3.py/labels{/name}","releases_url":"https://api.github.com/repos/sigmavirus24/github3.py/releases{/id}","deployments_url":"https://api.github.com/repos/sigmavirus24/github3.py/deployments","created_at":"2012-03-13T19:58:53Z","updated_at":"2016-03-07T16:04:16Z","pushed_at":"2016-03-11T11:30:33Z","git_url":"git://github.com/sigmavirus24/github3.py.git","ssh_url":"git@github.com:sigmavirus24/github3.py.git","clone_url":"https://github.com/sigmavirus24/github3.py.git","svn_url":"https://github.com/sigmavirus24/github3.py","homepage":"http://github3py.readthedocs.org/","size":8122,"stargazers_count":475,"watchers_count":475,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":true,"forks_count":175,"mirror_url":null,"open_issues_count":52,"forks":175,"open_issues":52,"watchers":475,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/587"},"html":{"href":"https://github.com/sigmavirus24/github3.py/pull/587"},"issue":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/issues/587"},"comments":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/issues/587/comments"},"review_comments":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/587/comments"},"review_comment":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/pulls/587/commits"},"statuses":{"href":"https://api.github.com/repos/sigmavirus24/github3.py/statuses/04c549c9104a98e3b1e9929fe3f402fa01a8bea6"}}}}