{"action":"created","comment":{"url":"https://api.github.com/repos/osuosl/pymesync/pulls/comments/48057107","id":48057107,"diff_hunk":"@@ -357,9 +357,16 @@ def _local_auth_error(self):\n         return None if self.token else (\"Not authenticated with TimeSync, \"\n                                         \"call self.authenticate() first\")\n \n-    def _json_to_python(self, json_object):\n-        \"\"\"Convert json object to native python list of objects\"\"\"\n-        python_object = json.loads(str(json_object))\n+    def _response_to_python(self, response):\n+        \"\"\"Convert response to native python list of objects\"\"\"\n+        try:\n+            python_object = json.loads(str(response.text))\n+        except ValueError:\n+            # If we get a ValueError, response.text isn't a JSON object, and\n+            # therefore didn't come from a TimeSync connection.\n+            error_message = \"your baseurl {0} returned status {1}\".format(","path":"pymesync.py","position":56,"original_position":56,"commit_id":"95264e1113082fa164e450bd04367cd8393dcf8a","original_commit_id":"95264e1113082fa164e450bd04367cd8393dcf8a","user":{"login":"Kennric","id":1696096,"avatar_url":"https://avatars.githubusercontent.com/u/1696096?v=3","gravatar_id":"","url":"https://api.github.com/users/Kennric","html_url":"https://github.com/Kennric","followers_url":"https://api.github.com/users/Kennric/followers","following_url":"https://api.github.com/users/Kennric/following{/other_user}","gists_url":"https://api.github.com/users/Kennric/gists{/gist_id}","starred_url":"https://api.github.com/users/Kennric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kennric/subscriptions","organizations_url":"https://api.github.com/users/Kennric/orgs","repos_url":"https://api.github.com/users/Kennric/repos","events_url":"https://api.github.com/users/Kennric/events{/privacy}","received_events_url":"https://api.github.com/users/Kennric/received_events","type":"User","site_admin":false},"body":"I think I would re-word this. If we get a 200 (a normal page, just not timesync, or someone sends a 404 page with 200 status), it's going to be confusing to see 'error, your baseurl returned 200.' Maybe 'connection to timesync failed at baseurl {0}. Response status was: {1}'","created_at":"2015-12-18T18:58:54Z","updated_at":"2015-12-18T18:58:54Z","html_url":"https://github.com/osuosl/pymesync/pull/71#discussion_r48057107","pull_request_url":"https://api.github.com/repos/osuosl/pymesync/pulls/71","_links":{"self":{"href":"https://api.github.com/repos/osuosl/pymesync/pulls/comments/48057107"},"html":{"href":"https://github.com/osuosl/pymesync/pull/71#discussion_r48057107"},"pull_request":{"href":"https://api.github.com/repos/osuosl/pymesync/pulls/71"}}},"pull_request":{"url":"https://api.github.com/repos/osuosl/pymesync/pulls/71","id":54128374,"html_url":"https://github.com/osuosl/pymesync/pull/71","diff_url":"https://github.com/osuosl/pymesync/pull/71.diff","patch_url":"https://github.com/osuosl/pymesync/pull/71.patch","issue_url":"https://api.github.com/repos/osuosl/pymesync/issues/71","number":71,"state":"open","locked":false,"title":"Handle html responses","user":{"login":"matthewrsj","id":12090084,"avatar_url":"https://avatars.githubusercontent.com/u/12090084?v=3","gravatar_id":"","url":"https://api.github.com/users/matthewrsj","html_url":"https://github.com/matthewrsj","followers_url":"https://api.github.com/users/matthewrsj/followers","following_url":"https://api.github.com/users/matthewrsj/following{/other_user}","gists_url":"https://api.github.com/users/matthewrsj/gists{/gist_id}","starred_url":"https://api.github.com/users/matthewrsj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matthewrsj/subscriptions","organizations_url":"https://api.github.com/users/matthewrsj/orgs","repos_url":"https://api.github.com/users/matthewrsj/repos","events_url":"https://api.github.com/users/matthewrsj/events{/privacy}","received_events_url":"https://api.github.com/users/matthewrsj/received_events","type":"User","site_admin":false},"body":"#70\r\n\r\nHandle HTTP responses that do not have JSON response bodies.\r\n* Put ``json.loads`` in a try - except block, format an error message in the except\r\n* Rename ``_json_to_python()`` to ``_response_to_python()`` and pass it the entire response so it can handle all types","created_at":"2015-12-18T17:28:55Z","updated_at":"2015-12-18T18:58:54Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1870e20c6dfc498fbae1d61b6b698a8ee169635d","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/osuosl/pymesync/pulls/71/commits","review_comments_url":"https://api.github.com/repos/osuosl/pymesync/pulls/71/comments","review_comment_url":"https://api.github.com/repos/osuosl/pymesync/pulls/comments{/number}","comments_url":"https://api.github.com/repos/osuosl/pymesync/issues/71/comments","statuses_url":"https://api.github.com/repos/osuosl/pymesync/statuses/95264e1113082fa164e450bd04367cd8393dcf8a","head":{"label":"osuosl:mrsj/html-response","ref":"mrsj/html-response","sha":"95264e1113082fa164e450bd04367cd8393dcf8a","user":{"login":"osuosl","id":1380625,"avatar_url":"https://avatars.githubusercontent.com/u/1380625?v=3","gravatar_id":"","url":"https://api.github.com/users/osuosl","html_url":"https://github.com/osuosl","followers_url":"https://api.github.com/users/osuosl/followers","following_url":"https://api.github.com/users/osuosl/following{/other_user}","gists_url":"https://api.github.com/users/osuosl/gists{/gist_id}","starred_url":"https://api.github.com/users/osuosl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osuosl/subscriptions","organizations_url":"https://api.github.com/users/osuosl/orgs","repos_url":"https://api.github.com/users/osuosl/repos","events_url":"https://api.github.com/users/osuosl/events{/privacy}","received_events_url":"https://api.github.com/users/osuosl/received_events","type":"Organization","site_admin":false},"repo":{"id":44197569,"name":"pymesync","full_name":"osuosl/pymesync","owner":{"login":"osuosl","id":1380625,"avatar_url":"https://avatars.githubusercontent.com/u/1380625?v=3","gravatar_id":"","url":"https://api.github.com/users/osuosl","html_url":"https://github.com/osuosl","followers_url":"https://api.github.com/users/osuosl/followers","following_url":"https://api.github.com/users/osuosl/following{/other_user}","gists_url":"https://api.github.com/users/osuosl/gists{/gist_id}","starred_url":"https://api.github.com/users/osuosl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osuosl/subscriptions","organizations_url":"https://api.github.com/users/osuosl/orgs","repos_url":"https://api.github.com/users/osuosl/repos","events_url":"https://api.github.com/users/osuosl/events{/privacy}","received_events_url":"https://api.github.com/users/osuosl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/osuosl/pymesync","description":"Python module to interface with the TimeSync API","fork":false,"url":"https://api.github.com/repos/osuosl/pymesync","forks_url":"https://api.github.com/repos/osuosl/pymesync/forks","keys_url":"https://api.github.com/repos/osuosl/pymesync/keys{/key_id}","collaborators_url":"https://api.github.com/repos/osuosl/pymesync/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/osuosl/pymesync/teams","hooks_url":"https://api.github.com/repos/osuosl/pymesync/hooks","issue_events_url":"https://api.github.com/repos/osuosl/pymesync/issues/events{/number}","events_url":"https://api.github.com/repos/osuosl/pymesync/events","assignees_url":"https://api.github.com/repos/osuosl/pymesync/assignees{/user}","branches_url":"https://api.github.com/repos/osuosl/pymesync/branches{/branch}","tags_url":"https://api.github.com/repos/osuosl/pymesync/tags","blobs_url":"https://api.github.com/repos/osuosl/pymesync/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/osuosl/pymesync/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/osuosl/pymesync/git/refs{/sha}","trees_url":"https://api.github.com/repos/osuosl/pymesync/git/trees{/sha}","statuses_url":"https://api.github.com/repos/osuosl/pymesync/statuses/{sha}","languages_url":"https://api.github.com/repos/osuosl/pymesync/languages","stargazers_url":"https://api.github.com/repos/osuosl/pymesync/stargazers","contributors_url":"https://api.github.com/repos/osuosl/pymesync/contributors","subscribers_url":"https://api.github.com/repos/osuosl/pymesync/subscribers","subscription_url":"https://api.github.com/repos/osuosl/pymesync/subscription","commits_url":"https://api.github.com/repos/osuosl/pymesync/commits{/sha}","git_commits_url":"https://api.github.com/repos/osuosl/pymesync/git/commits{/sha}","comments_url":"https://api.github.com/repos/osuosl/pymesync/comments{/number}","issue_comment_url":"https://api.github.com/repos/osuosl/pymesync/issues/comments{/number}","contents_url":"https://api.github.com/repos/osuosl/pymesync/contents/{+path}","compare_url":"https://api.github.com/repos/osuosl/pymesync/compare/{base}...{head}","merges_url":"https://api.github.com/repos/osuosl/pymesync/merges","archive_url":"https://api.github.com/repos/osuosl/pymesync/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/osuosl/pymesync/downloads","issues_url":"https://api.github.com/repos/osuosl/pymesync/issues{/number}","pulls_url":"https://api.github.com/repos/osuosl/pymesync/pulls{/number}","milestones_url":"https://api.github.com/repos/osuosl/pymesync/milestones{/number}","notifications_url":"https://api.github.com/repos/osuosl/pymesync/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/osuosl/pymesync/labels{/name}","releases_url":"https://api.github.com/repos/osuosl/pymesync/releases{/id}","created_at":"2015-10-13T18:50:03Z","updated_at":"2015-10-23T20:52:41Z","pushed_at":"2015-12-18T18:14:26Z","git_url":"git://github.com/osuosl/pymesync.git","ssh_url":"git@github.com:osuosl/pymesync.git","clone_url":"https://github.com/osuosl/pymesync.git","svn_url":"https://github.com/osuosl/pymesync","homepage":null,"size":943,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":12,"forks":0,"open_issues":12,"watchers":0,"default_branch":"develop"}},"base":{"label":"osuosl:develop","ref":"develop","sha":"d7278087142686b5d216af64be3e01e481c6cdfc","user":{"login":"osuosl","id":1380625,"avatar_url":"https://avatars.githubusercontent.com/u/1380625?v=3","gravatar_id":"","url":"https://api.github.com/users/osuosl","html_url":"https://github.com/osuosl","followers_url":"https://api.github.com/users/osuosl/followers","following_url":"https://api.github.com/users/osuosl/following{/other_user}","gists_url":"https://api.github.com/users/osuosl/gists{/gist_id}","starred_url":"https://api.github.com/users/osuosl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osuosl/subscriptions","organizations_url":"https://api.github.com/users/osuosl/orgs","repos_url":"https://api.github.com/users/osuosl/repos","events_url":"https://api.github.com/users/osuosl/events{/privacy}","received_events_url":"https://api.github.com/users/osuosl/received_events","type":"Organization","site_admin":false},"repo":{"id":44197569,"name":"pymesync","full_name":"osuosl/pymesync","owner":{"login":"osuosl","id":1380625,"avatar_url":"https://avatars.githubusercontent.com/u/1380625?v=3","gravatar_id":"","url":"https://api.github.com/users/osuosl","html_url":"https://github.com/osuosl","followers_url":"https://api.github.com/users/osuosl/followers","following_url":"https://api.github.com/users/osuosl/following{/other_user}","gists_url":"https://api.github.com/users/osuosl/gists{/gist_id}","starred_url":"https://api.github.com/users/osuosl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osuosl/subscriptions","organizations_url":"https://api.github.com/users/osuosl/orgs","repos_url":"https://api.github.com/users/osuosl/repos","events_url":"https://api.github.com/users/osuosl/events{/privacy}","received_events_url":"https://api.github.com/users/osuosl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/osuosl/pymesync","description":"Python module to interface with the TimeSync API","fork":false,"url":"https://api.github.com/repos/osuosl/pymesync","forks_url":"https://api.github.com/repos/osuosl/pymesync/forks","keys_url":"https://api.github.com/repos/osuosl/pymesync/keys{/key_id}","collaborators_url":"https://api.github.com/repos/osuosl/pymesync/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/osuosl/pymesync/teams","hooks_url":"https://api.github.com/repos/osuosl/pymesync/hooks","issue_events_url":"https://api.github.com/repos/osuosl/pymesync/issues/events{/number}","events_url":"https://api.github.com/repos/osuosl/pymesync/events","assignees_url":"https://api.github.com/repos/osuosl/pymesync/assignees{/user}","branches_url":"https://api.github.com/repos/osuosl/pymesync/branches{/branch}","tags_url":"https://api.github.com/repos/osuosl/pymesync/tags","blobs_url":"https://api.github.com/repos/osuosl/pymesync/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/osuosl/pymesync/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/osuosl/pymesync/git/refs{/sha}","trees_url":"https://api.github.com/repos/osuosl/pymesync/git/trees{/sha}","statuses_url":"https://api.github.com/repos/osuosl/pymesync/statuses/{sha}","languages_url":"https://api.github.com/repos/osuosl/pymesync/languages","stargazers_url":"https://api.github.com/repos/osuosl/pymesync/stargazers","contributors_url":"https://api.github.com/repos/osuosl/pymesync/contributors","subscribers_url":"https://api.github.com/repos/osuosl/pymesync/subscribers","subscription_url":"https://api.github.com/repos/osuosl/pymesync/subscription","commits_url":"https://api.github.com/repos/osuosl/pymesync/commits{/sha}","git_commits_url":"https://api.github.com/repos/osuosl/pymesync/git/commits{/sha}","comments_url":"https://api.github.com/repos/osuosl/pymesync/comments{/number}","issue_comment_url":"https://api.github.com/repos/osuosl/pymesync/issues/comments{/number}","contents_url":"https://api.github.com/repos/osuosl/pymesync/contents/{+path}","compare_url":"https://api.github.com/repos/osuosl/pymesync/compare/{base}...{head}","merges_url":"https://api.github.com/repos/osuosl/pymesync/merges","archive_url":"https://api.github.com/repos/osuosl/pymesync/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/osuosl/pymesync/downloads","issues_url":"https://api.github.com/repos/osuosl/pymesync/issues{/number}","pulls_url":"https://api.github.com/repos/osuosl/pymesync/pulls{/number}","milestones_url":"https://api.github.com/repos/osuosl/pymesync/milestones{/number}","notifications_url":"https://api.github.com/repos/osuosl/pymesync/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/osuosl/pymesync/labels{/name}","releases_url":"https://api.github.com/repos/osuosl/pymesync/releases{/id}","created_at":"2015-10-13T18:50:03Z","updated_at":"2015-10-23T20:52:41Z","pushed_at":"2015-12-18T18:14:26Z","git_url":"git://github.com/osuosl/pymesync.git","ssh_url":"git@github.com:osuosl/pymesync.git","clone_url":"https://github.com/osuosl/pymesync.git","svn_url":"https://github.com/osuosl/pymesync","homepage":null,"size":943,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":12,"forks":0,"open_issues":12,"watchers":0,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/osuosl/pymesync/pulls/71"},"html":{"href":"https://github.com/osuosl/pymesync/pull/71"},"issue":{"href":"https://api.github.com/repos/osuosl/pymesync/issues/71"},"comments":{"href":"https://api.github.com/repos/osuosl/pymesync/issues/71/comments"},"review_comments":{"href":"https://api.github.com/repos/osuosl/pymesync/pulls/71/comments"},"review_comment":{"href":"https://api.github.com/repos/osuosl/pymesync/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/osuosl/pymesync/pulls/71/commits"},"statuses":{"href":"https://api.github.com/repos/osuosl/pymesync/statuses/95264e1113082fa164e450bd04367cd8393dcf8a"}}}}