{"action":"created","comment":{"url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/pulls/comments/171106664","pull_request_review_id":99901821,"id":171106664,"diff_hunk":"@@ -41,23 +45,37 @@\n apiKey = \"\"\r\n \r\n def get_oauth_token():\r\n-    creds = b64encode(clientId + ':' + apiKey)\r\n+    data = clientId + ':' + apiKey\r\n \r\n-    url = \"http://\" + CBUS_IP + GET_TOKEN\r\n-    headers = {'Authorization': 'Basic ' + creds}\r\n-    body = urllib.urlencode({'grant_type': 'client_credentials'})\r\n+    # Handle differently for Python3\r\n+    if sys.version_info[0] == 3:\r\n+        data_bytes = data.encode(\"utf-8\")\r\n+        creds = b64encode(data_bytes)\r\n+        creds = creds.decode(\"utf-8\")\r\n+        url = \"http://\" + CBUS_IP + GET_TOKEN\r\n+        headers = {'Authorization': 'Basic ' + creds}\r\n+        body = urllib.parse.urlencode({'grant_type': 'client_credentials'})\r\n+    else:\r\n+        creds = b64encode(data)\r\n+        url = \"http://\" + CBUS_IP + GET_TOKEN\r\n+        headers = {'Authorization': 'Basic ' + creds}\r\n+        body = urllib.urlencode({'grant_type': 'client_credentials'})\r\n \r\n     response = get_response(url, data=body, headers=headers)\r\n \r\n     if 'access_token' in response:\r\n-        return json.loads(response)\r\n+        return response\r","path":"cloudbus.py","position":45,"original_position":45,"commit_id":"aa1e5f6c568fb018afc459d035e781316f7632c1","original_commit_id":"aa1e5f6c568fb018afc459d035e781316f7632c1","user":{"login":"rmay-intwine","id":17689393,"avatar_url":"https://avatars1.githubusercontent.com/u/17689393?v=4","gravatar_id":"","url":"https://api.github.com/users/rmay-intwine","html_url":"https://github.com/rmay-intwine","followers_url":"https://api.github.com/users/rmay-intwine/followers","following_url":"https://api.github.com/users/rmay-intwine/following{/other_user}","gists_url":"https://api.github.com/users/rmay-intwine/gists{/gist_id}","starred_url":"https://api.github.com/users/rmay-intwine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rmay-intwine/subscriptions","organizations_url":"https://api.github.com/users/rmay-intwine/orgs","repos_url":"https://api.github.com/users/rmay-intwine/repos","events_url":"https://api.github.com/users/rmay-intwine/events{/privacy}","received_events_url":"https://api.github.com/users/rmay-intwine/received_events","type":"User","site_admin":false},"body":"lmao - good catch","created_at":"2018-02-27T23:58:13Z","updated_at":"2018-02-27T23:59:45Z","html_url":"https://github.com/IntwineConnect/cloudbus_data_analysis/pull/4#discussion_r171106664","pull_request_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/pulls/4","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/pulls/comments/171106664"},"html":{"href":"https://github.com/IntwineConnect/cloudbus_data_analysis/pull/4#discussion_r171106664"},"pull_request":{"href":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/pulls/4","id":171812429,"html_url":"https://github.com/IntwineConnect/cloudbus_data_analysis/pull/4","diff_url":"https://github.com/IntwineConnect/cloudbus_data_analysis/pull/4.diff","patch_url":"https://github.com/IntwineConnect/cloudbus_data_analysis/pull/4.patch","issue_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/issues/4","number":4,"state":"open","locked":false,"title":"Fixes to enable Python3 to use OAuth.","user":{"login":"jimbalaya","id":10549601,"avatar_url":"https://avatars2.githubusercontent.com/u/10549601?v=4","gravatar_id":"","url":"https://api.github.com/users/jimbalaya","html_url":"https://github.com/jimbalaya","followers_url":"https://api.github.com/users/jimbalaya/followers","following_url":"https://api.github.com/users/jimbalaya/following{/other_user}","gists_url":"https://api.github.com/users/jimbalaya/gists{/gist_id}","starred_url":"https://api.github.com/users/jimbalaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimbalaya/subscriptions","organizations_url":"https://api.github.com/users/jimbalaya/orgs","repos_url":"https://api.github.com/users/jimbalaya/repos","events_url":"https://api.github.com/users/jimbalaya/events{/privacy}","received_events_url":"https://api.github.com/users/jimbalaya/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-02-27T23:12:46Z","updated_at":"2018-02-27T23:59:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f89e534fc9c5f2612c8f84bc3f4c7a19c416723f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/pulls/4/commits","review_comments_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/pulls/4/comments","review_comment_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/pulls/comments{/number}","comments_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/issues/4/comments","statuses_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/statuses/aa1e5f6c568fb018afc459d035e781316f7632c1","head":{"label":"jimbalaya:oauth","ref":"oauth","sha":"aa1e5f6c568fb018afc459d035e781316f7632c1","user":{"login":"jimbalaya","id":10549601,"avatar_url":"https://avatars2.githubusercontent.com/u/10549601?v=4","gravatar_id":"","url":"https://api.github.com/users/jimbalaya","html_url":"https://github.com/jimbalaya","followers_url":"https://api.github.com/users/jimbalaya/followers","following_url":"https://api.github.com/users/jimbalaya/following{/other_user}","gists_url":"https://api.github.com/users/jimbalaya/gists{/gist_id}","starred_url":"https://api.github.com/users/jimbalaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimbalaya/subscriptions","organizations_url":"https://api.github.com/users/jimbalaya/orgs","repos_url":"https://api.github.com/users/jimbalaya/repos","events_url":"https://api.github.com/users/jimbalaya/events{/privacy}","received_events_url":"https://api.github.com/users/jimbalaya/received_events","type":"User","site_admin":false},"repo":{"id":99269148,"name":"cloudbus_data_analysis","full_name":"jimbalaya/cloudbus_data_analysis","owner":{"login":"jimbalaya","id":10549601,"avatar_url":"https://avatars2.githubusercontent.com/u/10549601?v=4","gravatar_id":"","url":"https://api.github.com/users/jimbalaya","html_url":"https://github.com/jimbalaya","followers_url":"https://api.github.com/users/jimbalaya/followers","following_url":"https://api.github.com/users/jimbalaya/following{/other_user}","gists_url":"https://api.github.com/users/jimbalaya/gists{/gist_id}","starred_url":"https://api.github.com/users/jimbalaya/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jimbalaya/subscriptions","organizations_url":"https://api.github.com/users/jimbalaya/orgs","repos_url":"https://api.github.com/users/jimbalaya/repos","events_url":"https://api.github.com/users/jimbalaya/events{/privacy}","received_events_url":"https://api.github.com/users/jimbalaya/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jimbalaya/cloudbus_data_analysis","description":"Repo of code that can be used to read from Intwine's CloudBUS IoT system.","fork":true,"url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis","forks_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/forks","keys_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/teams","hooks_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/hooks","issue_events_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/issues/events{/number}","events_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/events","assignees_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/assignees{/user}","branches_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/branches{/branch}","tags_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/tags","blobs_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/git/refs{/sha}","trees_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/statuses/{sha}","languages_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/languages","stargazers_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/stargazers","contributors_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/contributors","subscribers_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/subscribers","subscription_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/subscription","commits_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/commits{/sha}","git_commits_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/git/commits{/sha}","comments_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/comments{/number}","issue_comment_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/issues/comments{/number}","contents_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/contents/{+path}","compare_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/merges","archive_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/downloads","issues_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/issues{/number}","pulls_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/pulls{/number}","milestones_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/milestones{/number}","notifications_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/labels{/name}","releases_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/releases{/id}","deployments_url":"https://api.github.com/repos/jimbalaya/cloudbus_data_analysis/deployments","created_at":"2017-08-03T19:45:12Z","updated_at":"2017-08-03T19:45:14Z","pushed_at":"2018-02-27T23:12:06Z","git_url":"git://github.com/jimbalaya/cloudbus_data_analysis.git","ssh_url":"git@github.com:jimbalaya/cloudbus_data_analysis.git","clone_url":"https://github.com/jimbalaya/cloudbus_data_analysis.git","svn_url":"https://github.com/jimbalaya/cloudbus_data_analysis","homepage":null,"size":7,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"IntwineConnect:oauth","ref":"oauth","sha":"d4d635c5c927b384901804b2151ac016632b92c2","user":{"login":"IntwineConnect","id":17689410,"avatar_url":"https://avatars2.githubusercontent.com/u/17689410?v=4","gravatar_id":"","url":"https://api.github.com/users/IntwineConnect","html_url":"https://github.com/IntwineConnect","followers_url":"https://api.github.com/users/IntwineConnect/followers","following_url":"https://api.github.com/users/IntwineConnect/following{/other_user}","gists_url":"https://api.github.com/users/IntwineConnect/gists{/gist_id}","starred_url":"https://api.github.com/users/IntwineConnect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IntwineConnect/subscriptions","organizations_url":"https://api.github.com/users/IntwineConnect/orgs","repos_url":"https://api.github.com/users/IntwineConnect/repos","events_url":"https://api.github.com/users/IntwineConnect/events{/privacy}","received_events_url":"https://api.github.com/users/IntwineConnect/received_events","type":"Organization","site_admin":false},"repo":{"id":99257314,"name":"cloudbus_data_analysis","full_name":"IntwineConnect/cloudbus_data_analysis","owner":{"login":"IntwineConnect","id":17689410,"avatar_url":"https://avatars2.githubusercontent.com/u/17689410?v=4","gravatar_id":"","url":"https://api.github.com/users/IntwineConnect","html_url":"https://github.com/IntwineConnect","followers_url":"https://api.github.com/users/IntwineConnect/followers","following_url":"https://api.github.com/users/IntwineConnect/following{/other_user}","gists_url":"https://api.github.com/users/IntwineConnect/gists{/gist_id}","starred_url":"https://api.github.com/users/IntwineConnect/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IntwineConnect/subscriptions","organizations_url":"https://api.github.com/users/IntwineConnect/orgs","repos_url":"https://api.github.com/users/IntwineConnect/repos","events_url":"https://api.github.com/users/IntwineConnect/events{/privacy}","received_events_url":"https://api.github.com/users/IntwineConnect/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/IntwineConnect/cloudbus_data_analysis","description":"Repo of code that can be used to read from Intwine's CloudBUS IoT system.","fork":false,"url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis","forks_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/forks","keys_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/teams","hooks_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/hooks","issue_events_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/issues/events{/number}","events_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/events","assignees_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/assignees{/user}","branches_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/branches{/branch}","tags_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/tags","blobs_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/git/refs{/sha}","trees_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/statuses/{sha}","languages_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/languages","stargazers_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/stargazers","contributors_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/contributors","subscribers_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/subscribers","subscription_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/subscription","commits_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/commits{/sha}","git_commits_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/git/commits{/sha}","comments_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/comments{/number}","issue_comment_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/issues/comments{/number}","contents_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/contents/{+path}","compare_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/merges","archive_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/downloads","issues_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/issues{/number}","pulls_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/pulls{/number}","milestones_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/milestones{/number}","notifications_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/labels{/name}","releases_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/releases{/id}","deployments_url":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/deployments","created_at":"2017-08-03T17:13:28Z","updated_at":"2017-08-03T17:14:55Z","pushed_at":"2018-02-27T23:12:47Z","git_url":"git://github.com/IntwineConnect/cloudbus_data_analysis.git","ssh_url":"git@github.com:IntwineConnect/cloudbus_data_analysis.git","clone_url":"https://github.com/IntwineConnect/cloudbus_data_analysis.git","svn_url":"https://github.com/IntwineConnect/cloudbus_data_analysis","homepage":null,"size":217,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"archived":false,"open_issues_count":1,"license":{"key":"bsd-2-clause","name":"BSD 2-Clause \"Simplified\" License","spdx_id":"BSD-2-Clause","url":"https://api.github.com/licenses/bsd-2-clause"},"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/pulls/4"},"html":{"href":"https://github.com/IntwineConnect/cloudbus_data_analysis/pull/4"},"issue":{"href":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/issues/4"},"comments":{"href":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/IntwineConnect/cloudbus_data_analysis/statuses/aa1e5f6c568fb018afc459d035e781316f7632c1"}},"author_association":"NONE"}}
{"actor":{"display_login":"rmay-intwine"}}