{"action":"created","comment":{"url":"https://api.github.com/repos/ifosch/accloudtant/pulls/comments/155918796","pull_request_review_id":82321929,"id":155918796,"diff_hunk":"@@ -108,17 +115,79 @@ def print_prices(instances=None, region='us-east-1'):\n             partial_upfront_3yr = eval_price_exists(hourly_price)\n             hourly_price = rsrvd_3yr[all_upfront]['effectiveHourly']\n             all_upfront_3yr = eval_price_exists(hourly_price)\n-            row = [size,\n+            row = [region,\n+                   size,\n                    on_demand,\n                    no_upfront,\n                    partial_upfront_1yr,\n                    all_upfront_1yr,\n                    partial_upfront_3yr,\n                    all_upfront_3yr]\n             table.append(row)\n-    output = \"EC2 (Hourly prices, no upfronts, no instance type features):\\n\"\n-    output += tabulate(table, headers)\n-    return output\n+        if output_format == 'table':\n+            output = \"EC2 (Hourly prices, no upfronts, no instance type features):\\n\"\n+            output += tabulate(table, headers,tablefmt=\"fancy_grid\")\n+            if save != 'no':\n+                print ('Please note table format will not be saved in any files')\n+            return output\n+\n+        elif output_format == 'csv':\n+            output = ''\n+            for header in headers:\n+                output += header + ','\n+            output = output[:-1] + '\\n'\n+            for row in table:\n+                for column in row:\n+                    output += str(column) + ','\n+                output = output[:-1] + '\\n'\n+            if save != 'no':\n+                output_file_name = save + \"/accloudtant-list-\" + str(time_now) + \"-\" + region + \".csv\"\n+                output_file = open(output_file_name,'w')\n+                output_file.write(output[:-1])\n+                output_file.close()\n+                print ('The output is saved in ' + output_file_name)\n+            return output[:-1]\n+\n+        elif output_format == 'json':\n+            json_output = \"[\\n{\\n\"","path":"accloudtant/aws/prices.py","position":119,"original_position":119,"commit_id":"84bdf3b35f209072f8bcfbc81d2812bf0d945b5c","original_commit_id":"84bdf3b35f209072f8bcfbc81d2812bf0d945b5c","user":{"login":"ifosch","id":2912400,"avatar_url":"https://avatars1.githubusercontent.com/u/2912400?v=4","gravatar_id":"","url":"https://api.github.com/users/ifosch","html_url":"https://github.com/ifosch","followers_url":"https://api.github.com/users/ifosch/followers","following_url":"https://api.github.com/users/ifosch/following{/other_user}","gists_url":"https://api.github.com/users/ifosch/gists{/gist_id}","starred_url":"https://api.github.com/users/ifosch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ifosch/subscriptions","organizations_url":"https://api.github.com/users/ifosch/orgs","repos_url":"https://api.github.com/users/ifosch/repos","events_url":"https://api.github.com/users/ifosch/events{/privacy}","received_events_url":"https://api.github.com/users/ifosch/received_events","type":"User","site_admin":false},"body":"I don't understand why this doesn't use `json.dump` (See [reference|https://docs.python.org/2/library/json.html#basic-usage]). ","created_at":"2017-12-09T10:47:34Z","updated_at":"2017-12-09T10:47:34Z","html_url":"https://github.com/ifosch/accloudtant/pull/117#discussion_r155918796","pull_request_url":"https://api.github.com/repos/ifosch/accloudtant/pulls/117","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/ifosch/accloudtant/pulls/comments/155918796"},"html":{"href":"https://github.com/ifosch/accloudtant/pull/117#discussion_r155918796"},"pull_request":{"href":"https://api.github.com/repos/ifosch/accloudtant/pulls/117"}}},"pull_request":{"url":"https://api.github.com/repos/ifosch/accloudtant/pulls/117","id":155729395,"html_url":"https://github.com/ifosch/accloudtant/pull/117","diff_url":"https://github.com/ifosch/accloudtant/pull/117.diff","patch_url":"https://github.com/ifosch/accloudtant/pull/117.patch","issue_url":"https://api.github.com/repos/ifosch/accloudtant/issues/117","number":117,"state":"open","locked":false,"title":"Fix115","user":{"login":"arunjayanth","id":34102600,"avatar_url":"https://avatars3.githubusercontent.com/u/34102600?v=4","gravatar_id":"","url":"https://api.github.com/users/arunjayanth","html_url":"https://github.com/arunjayanth","followers_url":"https://api.github.com/users/arunjayanth/followers","following_url":"https://api.github.com/users/arunjayanth/following{/other_user}","gists_url":"https://api.github.com/users/arunjayanth/gists{/gist_id}","starred_url":"https://api.github.com/users/arunjayanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arunjayanth/subscriptions","organizations_url":"https://api.github.com/users/arunjayanth/orgs","repos_url":"https://api.github.com/users/arunjayanth/repos","events_url":"https://api.github.com/users/arunjayanth/events{/privacy}","received_events_url":"https://api.github.com/users/arunjayanth/received_events","type":"User","site_admin":false},"body":"Fixed the KeyError['linux'] error and ['ri'] errors\r\n\r\nThe previous pull request was closed, as it was modified on a different branch.( older version) \r\nCorrected few bugs reported in reserved_counters and instance_counters\r\n\r\nEnhancements:\r\nA new column is added \"Region\" in the output\r\nAdded new options for location (multiple) and save for both list and report outputs in csv and json . Table format will not be saved.\r\nAdded JSON format as an output option  \r\nEnhanced table output format to a stylish format\r\n\r\n","created_at":"2017-11-30T21:55:44Z","updated_at":"2017-12-09T10:47:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5551c7098540f30643e27e2f30dd361457e336aa","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/ifosch/accloudtant/pulls/117/commits","review_comments_url":"https://api.github.com/repos/ifosch/accloudtant/pulls/117/comments","review_comment_url":"https://api.github.com/repos/ifosch/accloudtant/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ifosch/accloudtant/issues/117/comments","statuses_url":"https://api.github.com/repos/ifosch/accloudtant/statuses/84bdf3b35f209072f8bcfbc81d2812bf0d945b5c","head":{"label":"arunjayanth:fix115","ref":"fix115","sha":"84bdf3b35f209072f8bcfbc81d2812bf0d945b5c","user":{"login":"arunjayanth","id":34102600,"avatar_url":"https://avatars3.githubusercontent.com/u/34102600?v=4","gravatar_id":"","url":"https://api.github.com/users/arunjayanth","html_url":"https://github.com/arunjayanth","followers_url":"https://api.github.com/users/arunjayanth/followers","following_url":"https://api.github.com/users/arunjayanth/following{/other_user}","gists_url":"https://api.github.com/users/arunjayanth/gists{/gist_id}","starred_url":"https://api.github.com/users/arunjayanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arunjayanth/subscriptions","organizations_url":"https://api.github.com/users/arunjayanth/orgs","repos_url":"https://api.github.com/users/arunjayanth/repos","events_url":"https://api.github.com/users/arunjayanth/events{/privacy}","received_events_url":"https://api.github.com/users/arunjayanth/received_events","type":"User","site_admin":false},"repo":{"id":112499745,"name":"accloudtant","full_name":"arunjayanth/accloudtant","owner":{"login":"arunjayanth","id":34102600,"avatar_url":"https://avatars3.githubusercontent.com/u/34102600?v=4","gravatar_id":"","url":"https://api.github.com/users/arunjayanth","html_url":"https://github.com/arunjayanth","followers_url":"https://api.github.com/users/arunjayanth/followers","following_url":"https://api.github.com/users/arunjayanth/following{/other_user}","gists_url":"https://api.github.com/users/arunjayanth/gists{/gist_id}","starred_url":"https://api.github.com/users/arunjayanth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arunjayanth/subscriptions","organizations_url":"https://api.github.com/users/arunjayanth/orgs","repos_url":"https://api.github.com/users/arunjayanth/repos","events_url":"https://api.github.com/users/arunjayanth/events{/privacy}","received_events_url":"https://api.github.com/users/arunjayanth/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arunjayanth/accloudtant","description":"AWS cost calculator","fork":true,"url":"https://api.github.com/repos/arunjayanth/accloudtant","forks_url":"https://api.github.com/repos/arunjayanth/accloudtant/forks","keys_url":"https://api.github.com/repos/arunjayanth/accloudtant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arunjayanth/accloudtant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arunjayanth/accloudtant/teams","hooks_url":"https://api.github.com/repos/arunjayanth/accloudtant/hooks","issue_events_url":"https://api.github.com/repos/arunjayanth/accloudtant/issues/events{/number}","events_url":"https://api.github.com/repos/arunjayanth/accloudtant/events","assignees_url":"https://api.github.com/repos/arunjayanth/accloudtant/assignees{/user}","branches_url":"https://api.github.com/repos/arunjayanth/accloudtant/branches{/branch}","tags_url":"https://api.github.com/repos/arunjayanth/accloudtant/tags","blobs_url":"https://api.github.com/repos/arunjayanth/accloudtant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arunjayanth/accloudtant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arunjayanth/accloudtant/git/refs{/sha}","trees_url":"https://api.github.com/repos/arunjayanth/accloudtant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arunjayanth/accloudtant/statuses/{sha}","languages_url":"https://api.github.com/repos/arunjayanth/accloudtant/languages","stargazers_url":"https://api.github.com/repos/arunjayanth/accloudtant/stargazers","contributors_url":"https://api.github.com/repos/arunjayanth/accloudtant/contributors","subscribers_url":"https://api.github.com/repos/arunjayanth/accloudtant/subscribers","subscription_url":"https://api.github.com/repos/arunjayanth/accloudtant/subscription","commits_url":"https://api.github.com/repos/arunjayanth/accloudtant/commits{/sha}","git_commits_url":"https://api.github.com/repos/arunjayanth/accloudtant/git/commits{/sha}","comments_url":"https://api.github.com/repos/arunjayanth/accloudtant/comments{/number}","issue_comment_url":"https://api.github.com/repos/arunjayanth/accloudtant/issues/comments{/number}","contents_url":"https://api.github.com/repos/arunjayanth/accloudtant/contents/{+path}","compare_url":"https://api.github.com/repos/arunjayanth/accloudtant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arunjayanth/accloudtant/merges","archive_url":"https://api.github.com/repos/arunjayanth/accloudtant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arunjayanth/accloudtant/downloads","issues_url":"https://api.github.com/repos/arunjayanth/accloudtant/issues{/number}","pulls_url":"https://api.github.com/repos/arunjayanth/accloudtant/pulls{/number}","milestones_url":"https://api.github.com/repos/arunjayanth/accloudtant/milestones{/number}","notifications_url":"https://api.github.com/repos/arunjayanth/accloudtant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arunjayanth/accloudtant/labels{/name}","releases_url":"https://api.github.com/repos/arunjayanth/accloudtant/releases{/id}","deployments_url":"https://api.github.com/repos/arunjayanth/accloudtant/deployments","created_at":"2017-11-29T16:29:29Z","updated_at":"2017-11-29T16:29:31Z","pushed_at":"2017-12-05T19:14:12Z","git_url":"git://github.com/arunjayanth/accloudtant.git","ssh_url":"git@github.com:arunjayanth/accloudtant.git","clone_url":"https://github.com/arunjayanth/accloudtant.git","svn_url":"https://github.com/arunjayanth/accloudtant","homepage":null,"size":151,"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":"ifosch:master","ref":"master","sha":"e7ad29e5e4b0d25d9669fed4a9246089d5122f4e","user":{"login":"ifosch","id":2912400,"avatar_url":"https://avatars1.githubusercontent.com/u/2912400?v=4","gravatar_id":"","url":"https://api.github.com/users/ifosch","html_url":"https://github.com/ifosch","followers_url":"https://api.github.com/users/ifosch/followers","following_url":"https://api.github.com/users/ifosch/following{/other_user}","gists_url":"https://api.github.com/users/ifosch/gists{/gist_id}","starred_url":"https://api.github.com/users/ifosch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ifosch/subscriptions","organizations_url":"https://api.github.com/users/ifosch/orgs","repos_url":"https://api.github.com/users/ifosch/repos","events_url":"https://api.github.com/users/ifosch/events{/privacy}","received_events_url":"https://api.github.com/users/ifosch/received_events","type":"User","site_admin":false},"repo":{"id":39678965,"name":"accloudtant","full_name":"ifosch/accloudtant","owner":{"login":"ifosch","id":2912400,"avatar_url":"https://avatars1.githubusercontent.com/u/2912400?v=4","gravatar_id":"","url":"https://api.github.com/users/ifosch","html_url":"https://github.com/ifosch","followers_url":"https://api.github.com/users/ifosch/followers","following_url":"https://api.github.com/users/ifosch/following{/other_user}","gists_url":"https://api.github.com/users/ifosch/gists{/gist_id}","starred_url":"https://api.github.com/users/ifosch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ifosch/subscriptions","organizations_url":"https://api.github.com/users/ifosch/orgs","repos_url":"https://api.github.com/users/ifosch/repos","events_url":"https://api.github.com/users/ifosch/events{/privacy}","received_events_url":"https://api.github.com/users/ifosch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ifosch/accloudtant","description":"AWS cost calculator","fork":false,"url":"https://api.github.com/repos/ifosch/accloudtant","forks_url":"https://api.github.com/repos/ifosch/accloudtant/forks","keys_url":"https://api.github.com/repos/ifosch/accloudtant/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ifosch/accloudtant/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ifosch/accloudtant/teams","hooks_url":"https://api.github.com/repos/ifosch/accloudtant/hooks","issue_events_url":"https://api.github.com/repos/ifosch/accloudtant/issues/events{/number}","events_url":"https://api.github.com/repos/ifosch/accloudtant/events","assignees_url":"https://api.github.com/repos/ifosch/accloudtant/assignees{/user}","branches_url":"https://api.github.com/repos/ifosch/accloudtant/branches{/branch}","tags_url":"https://api.github.com/repos/ifosch/accloudtant/tags","blobs_url":"https://api.github.com/repos/ifosch/accloudtant/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ifosch/accloudtant/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ifosch/accloudtant/git/refs{/sha}","trees_url":"https://api.github.com/repos/ifosch/accloudtant/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ifosch/accloudtant/statuses/{sha}","languages_url":"https://api.github.com/repos/ifosch/accloudtant/languages","stargazers_url":"https://api.github.com/repos/ifosch/accloudtant/stargazers","contributors_url":"https://api.github.com/repos/ifosch/accloudtant/contributors","subscribers_url":"https://api.github.com/repos/ifosch/accloudtant/subscribers","subscription_url":"https://api.github.com/repos/ifosch/accloudtant/subscription","commits_url":"https://api.github.com/repos/ifosch/accloudtant/commits{/sha}","git_commits_url":"https://api.github.com/repos/ifosch/accloudtant/git/commits{/sha}","comments_url":"https://api.github.com/repos/ifosch/accloudtant/comments{/number}","issue_comment_url":"https://api.github.com/repos/ifosch/accloudtant/issues/comments{/number}","contents_url":"https://api.github.com/repos/ifosch/accloudtant/contents/{+path}","compare_url":"https://api.github.com/repos/ifosch/accloudtant/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ifosch/accloudtant/merges","archive_url":"https://api.github.com/repos/ifosch/accloudtant/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ifosch/accloudtant/downloads","issues_url":"https://api.github.com/repos/ifosch/accloudtant/issues{/number}","pulls_url":"https://api.github.com/repos/ifosch/accloudtant/pulls{/number}","milestones_url":"https://api.github.com/repos/ifosch/accloudtant/milestones{/number}","notifications_url":"https://api.github.com/repos/ifosch/accloudtant/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ifosch/accloudtant/labels{/name}","releases_url":"https://api.github.com/repos/ifosch/accloudtant/releases{/id}","deployments_url":"https://api.github.com/repos/ifosch/accloudtant/deployments","created_at":"2015-07-25T09:11:20Z","updated_at":"2017-10-25T08:48:50Z","pushed_at":"2017-12-05T19:14:14Z","git_url":"git://github.com/ifosch/accloudtant.git","ssh_url":"git@github.com:ifosch/accloudtant.git","clone_url":"https://github.com/ifosch/accloudtant.git","svn_url":"https://github.com/ifosch/accloudtant","homepage":null,"size":158,"stargazers_count":33,"watchers_count":33,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":10,"mirror_url":null,"archived":false,"open_issues_count":19,"license":{"key":"apache-2.0","name":"Apache License 2.0","spdx_id":"Apache-2.0","url":"https://api.github.com/licenses/apache-2.0"},"forks":10,"open_issues":19,"watchers":33,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ifosch/accloudtant/pulls/117"},"html":{"href":"https://github.com/ifosch/accloudtant/pull/117"},"issue":{"href":"https://api.github.com/repos/ifosch/accloudtant/issues/117"},"comments":{"href":"https://api.github.com/repos/ifosch/accloudtant/issues/117/comments"},"review_comments":{"href":"https://api.github.com/repos/ifosch/accloudtant/pulls/117/comments"},"review_comment":{"href":"https://api.github.com/repos/ifosch/accloudtant/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ifosch/accloudtant/pulls/117/commits"},"statuses":{"href":"https://api.github.com/repos/ifosch/accloudtant/statuses/84bdf3b35f209072f8bcfbc81d2812bf0d945b5c"}},"author_association":"NONE"}}
{"actor":{"display_login":"ifosch"}}