{"action":"created","comment":{"url":"https://api.github.com/repos/electriccommunity/electriccommander/pulls/comments/31982125","id":31982125,"diff_hunk":"@@ -162,91 +169,86 @@ def login(self, userName, password):\n             responseNode.getElementsByTagName(\"sessionId\")[0])\n         return result\n \n-    ############################################################\n-    # httpPost\n-    # \n-    #     Send a string request as post data to the Commander server.\n-    #     This method is mostly used internally, but module users\n-    #     may use it to send batch requests to Commander.\n-    ############################################################\n     def httpPost(self, reqData):\n+        \"\"\"\n+        Send a string request as post data to the Commander server.\n+        This method is mostly used internally, but module users\n+        may use it to send batch requests to Commander.\n+        \"\"\"\n         try:\n             resp, content = gHttpHandle.request(self.url, \"POST\",\n                                                 str.encode(reqData))\n             return content.decode(\"utf8\")\n         except socket.error as inst:\n-            raise Exception(inst)\n-\n-    ############################################################\n-    # createRequest\n-    # \n-    #     Create a Commander request (xml string) for the given request\n-    #     name and parameters.\n-    #\n-    # Arguments:\n-    #     requestName - Name of request (e.g. getProperty)\n-    #     params - dictionary whose keys are child element names\n-    #         (e.g. propertyName) and whose value is the value of the child\n-    #         element (e.g. \"prop1\"). For api calls that take complex\n-    #         arguments (e.g. findObjects), the value may be a dictionary\n-    #         (so the containing dictionary entry key becomes a non-leaf\n-    #         node in the request). Similarly, if the value of the child\n-    #         element is a list, it means this element should be emitted\n-    #         once for each value (e.g. \"groupName\" parameters in createUser).\n-    ############################################################\n-    def createRequest(self, requestName, params = {}):\n+            raise ElectricCommanderException(inst)\n+\n+    def createRequest(self, requestName, params=None, **kwparams):\n+        \"\"\"\n+        Create a Commander request (xml string) for the given request\n+        name and parameters.\n+\n+        Arguments:\n+            requestName - Name of request (e.g. getProperty)\n+            params - dictionary whose keys are child element names\n+                (e.g. propertyName) and whose value is the value of the child\n+                element (e.g. \"prop1\"). For api calls that take complex\n+                arguments (e.g. findObjects), the value may be a dictionary\n+                (so the containing dictionary entry key becomes a non-leaf\n+                node in the request). Similarly, if the value of the child\n+                element is a list, it means this element should be emitted\n+                once for each value (e.g. \"groupName\" parameters in createUser).\n+        \"\"\"\n         # Create a document that looks something like this:\n         # <request requestId=\"py-123\"><myRequest>...\n+        params = params or {}","path":"ElectricCommander-Python-Module/ec.py","position":208,"original_position":208,"commit_id":"1e4d725478d53b29a416b8143aada7daefdbfd14","original_commit_id":"1e4d725478d53b29a416b8143aada7daefdbfd14","user":{"login":"stamhankar999","id":1156615,"avatar_url":"https://avatars.githubusercontent.com/u/1156615?v=3","gravatar_id":"","url":"https://api.github.com/users/stamhankar999","html_url":"https://github.com/stamhankar999","followers_url":"https://api.github.com/users/stamhankar999/followers","following_url":"https://api.github.com/users/stamhankar999/following{/other_user}","gists_url":"https://api.github.com/users/stamhankar999/gists{/gist_id}","starred_url":"https://api.github.com/users/stamhankar999/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stamhankar999/subscriptions","organizations_url":"https://api.github.com/users/stamhankar999/orgs","repos_url":"https://api.github.com/users/stamhankar999/repos","events_url":"https://api.github.com/users/stamhankar999/events{/privacy}","received_events_url":"https://api.github.com/users/stamhankar999/received_events","type":"User","site_admin":false},"body":"Does Python have an ||= operator? Then you could say:\r\n```params ||= {}```","created_at":"2015-06-09T04:31:11Z","updated_at":"2015-06-09T04:31:11Z","html_url":"https://github.com/electriccommunity/electriccommander/pull/6#discussion_r31982125","pull_request_url":"https://api.github.com/repos/electriccommunity/electriccommander/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/electriccommunity/electriccommander/pulls/comments/31982125"},"html":{"href":"https://github.com/electriccommunity/electriccommander/pull/6#discussion_r31982125"},"pull_request":{"href":"https://api.github.com/repos/electriccommunity/electriccommander/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/electriccommunity/electriccommander/pulls/6","id":32793742,"html_url":"https://github.com/electriccommunity/electriccommander/pull/6","diff_url":"https://github.com/electriccommunity/electriccommander/pull/6.diff","patch_url":"https://github.com/electriccommunity/electriccommander/pull/6.patch","issue_url":"https://api.github.com/repos/electriccommunity/electriccommander/issues/6","number":6,"state":"open","locked":false,"title":"Clean up ec.py","user":{"login":"AdricEpic","id":6932368,"avatar_url":"https://avatars.githubusercontent.com/u/6932368?v=3","gravatar_id":"","url":"https://api.github.com/users/AdricEpic","html_url":"https://github.com/AdricEpic","followers_url":"https://api.github.com/users/AdricEpic/followers","following_url":"https://api.github.com/users/AdricEpic/following{/other_user}","gists_url":"https://api.github.com/users/AdricEpic/gists{/gist_id}","starred_url":"https://api.github.com/users/AdricEpic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdricEpic/subscriptions","organizations_url":"https://api.github.com/users/AdricEpic/orgs","repos_url":"https://api.github.com/users/AdricEpic/repos","events_url":"https://api.github.com/users/AdricEpic/events{/privacy}","received_events_url":"https://api.github.com/users/AdricEpic/received_events","type":"User","site_admin":false},"body":"This PR cleans up a lot of issues that generated linter warnings when opened in PyCharm, and adds some functionality improvements.\r\n\r\n1. **Setup**: PyCharm complained about *httplib2* not being included in the module requirements. Added benefit: PyCharm displays a warning when a module's requirements are missing. This probably has other benefits.\r\n1. **Formatting**: Readability improvements without any functionality changes.\r\n1. **Hardening**: These [string formatting](http://stackoverflow.com/a/5082482), [path joining](http://stackoverflow.com/questions/13944387/why-use-os-path-join-over-string-concatenation), and [mutable defaults](http://docs.python-guide.org/en/latest/writing/gotchas/) changes should not affect functionality, but provide safer ways of handling those operations.\r\n1. **Exceptions**: It's generally better to raise a specific (in this case, custom) exception instead of a generic exception. This shouldn't break backwards compatibility since the new exception subclasses the previous exception type.\r\n1. **Keyword Arguments**: Requiring command arguments to be wrapped in a dict is an unnecessary layer of complexity. Now commands accept keyword arguments, which get wrapped into a dict behind-the-scenes, allowing for more Pythonic method calls. Passing a dict also works, so backwards compatibility should be maintained.","created_at":"2015-04-07T18:52:40Z","updated_at":"2015-06-09T04:31:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b61c575b91dea5ddb9bb99351632fc71edb4b8ed","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/electriccommunity/electriccommander/pulls/6/commits","review_comments_url":"https://api.github.com/repos/electriccommunity/electriccommander/pulls/6/comments","review_comment_url":"https://api.github.com/repos/electriccommunity/electriccommander/pulls/comments{/number}","comments_url":"https://api.github.com/repos/electriccommunity/electriccommander/issues/6/comments","statuses_url":"https://api.github.com/repos/electriccommunity/electriccommander/statuses/1e4d725478d53b29a416b8143aada7daefdbfd14","head":{"label":"AdricEpic:PythonCleanup","ref":"PythonCleanup","sha":"1e4d725478d53b29a416b8143aada7daefdbfd14","user":{"login":"AdricEpic","id":6932368,"avatar_url":"https://avatars.githubusercontent.com/u/6932368?v=3","gravatar_id":"","url":"https://api.github.com/users/AdricEpic","html_url":"https://github.com/AdricEpic","followers_url":"https://api.github.com/users/AdricEpic/followers","following_url":"https://api.github.com/users/AdricEpic/following{/other_user}","gists_url":"https://api.github.com/users/AdricEpic/gists{/gist_id}","starred_url":"https://api.github.com/users/AdricEpic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdricEpic/subscriptions","organizations_url":"https://api.github.com/users/AdricEpic/orgs","repos_url":"https://api.github.com/users/AdricEpic/repos","events_url":"https://api.github.com/users/AdricEpic/events{/privacy}","received_events_url":"https://api.github.com/users/AdricEpic/received_events","type":"User","site_admin":false},"repo":{"id":33482652,"name":"electriccommander","full_name":"AdricEpic/electriccommander","owner":{"login":"AdricEpic","id":6932368,"avatar_url":"https://avatars.githubusercontent.com/u/6932368?v=3","gravatar_id":"","url":"https://api.github.com/users/AdricEpic","html_url":"https://github.com/AdricEpic","followers_url":"https://api.github.com/users/AdricEpic/followers","following_url":"https://api.github.com/users/AdricEpic/following{/other_user}","gists_url":"https://api.github.com/users/AdricEpic/gists{/gist_id}","starred_url":"https://api.github.com/users/AdricEpic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AdricEpic/subscriptions","organizations_url":"https://api.github.com/users/AdricEpic/orgs","repos_url":"https://api.github.com/users/AdricEpic/repos","events_url":"https://api.github.com/users/AdricEpic/events{/privacy}","received_events_url":"https://api.github.com/users/AdricEpic/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/AdricEpic/electriccommander","description":"ElectricCommander automates and accelerates the application development (build-test-deploy) process and its supporting IT resources (physical, virtual, or public/private cloud).","fork":true,"url":"https://api.github.com/repos/AdricEpic/electriccommander","forks_url":"https://api.github.com/repos/AdricEpic/electriccommander/forks","keys_url":"https://api.github.com/repos/AdricEpic/electriccommander/keys{/key_id}","collaborators_url":"https://api.github.com/repos/AdricEpic/electriccommander/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/AdricEpic/electriccommander/teams","hooks_url":"https://api.github.com/repos/AdricEpic/electriccommander/hooks","issue_events_url":"https://api.github.com/repos/AdricEpic/electriccommander/issues/events{/number}","events_url":"https://api.github.com/repos/AdricEpic/electriccommander/events","assignees_url":"https://api.github.com/repos/AdricEpic/electriccommander/assignees{/user}","branches_url":"https://api.github.com/repos/AdricEpic/electriccommander/branches{/branch}","tags_url":"https://api.github.com/repos/AdricEpic/electriccommander/tags","blobs_url":"https://api.github.com/repos/AdricEpic/electriccommander/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/AdricEpic/electriccommander/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/AdricEpic/electriccommander/git/refs{/sha}","trees_url":"https://api.github.com/repos/AdricEpic/electriccommander/git/trees{/sha}","statuses_url":"https://api.github.com/repos/AdricEpic/electriccommander/statuses/{sha}","languages_url":"https://api.github.com/repos/AdricEpic/electriccommander/languages","stargazers_url":"https://api.github.com/repos/AdricEpic/electriccommander/stargazers","contributors_url":"https://api.github.com/repos/AdricEpic/electriccommander/contributors","subscribers_url":"https://api.github.com/repos/AdricEpic/electriccommander/subscribers","subscription_url":"https://api.github.com/repos/AdricEpic/electriccommander/subscription","commits_url":"https://api.github.com/repos/AdricEpic/electriccommander/commits{/sha}","git_commits_url":"https://api.github.com/repos/AdricEpic/electriccommander/git/commits{/sha}","comments_url":"https://api.github.com/repos/AdricEpic/electriccommander/comments{/number}","issue_comment_url":"https://api.github.com/repos/AdricEpic/electriccommander/issues/comments{/number}","contents_url":"https://api.github.com/repos/AdricEpic/electriccommander/contents/{+path}","compare_url":"https://api.github.com/repos/AdricEpic/electriccommander/compare/{base}...{head}","merges_url":"https://api.github.com/repos/AdricEpic/electriccommander/merges","archive_url":"https://api.github.com/repos/AdricEpic/electriccommander/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/AdricEpic/electriccommander/downloads","issues_url":"https://api.github.com/repos/AdricEpic/electriccommander/issues{/number}","pulls_url":"https://api.github.com/repos/AdricEpic/electriccommander/pulls{/number}","milestones_url":"https://api.github.com/repos/AdricEpic/electriccommander/milestones{/number}","notifications_url":"https://api.github.com/repos/AdricEpic/electriccommander/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/AdricEpic/electriccommander/labels{/name}","releases_url":"https://api.github.com/repos/AdricEpic/electriccommander/releases{/id}","created_at":"2015-04-06T13:13:42Z","updated_at":"2015-04-06T13:13:45Z","pushed_at":"2015-04-13T04:09:17Z","git_url":"git://github.com/AdricEpic/electriccommander.git","ssh_url":"git@github.com:AdricEpic/electriccommander.git","clone_url":"https://github.com/AdricEpic/electriccommander.git","svn_url":"https://github.com/AdricEpic/electriccommander","homepage":"http://community.electric-cloud.com/","size":155574,"stargazers_count":0,"watchers_count":0,"language":"Perl","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"electriccommunity:master","ref":"master","sha":"33161a4a2fabea446086fefab11f930367ff0b43","user":{"login":"electriccommunity","id":1568775,"avatar_url":"https://avatars.githubusercontent.com/u/1568775?v=3","gravatar_id":"","url":"https://api.github.com/users/electriccommunity","html_url":"https://github.com/electriccommunity","followers_url":"https://api.github.com/users/electriccommunity/followers","following_url":"https://api.github.com/users/electriccommunity/following{/other_user}","gists_url":"https://api.github.com/users/electriccommunity/gists{/gist_id}","starred_url":"https://api.github.com/users/electriccommunity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/electriccommunity/subscriptions","organizations_url":"https://api.github.com/users/electriccommunity/orgs","repos_url":"https://api.github.com/users/electriccommunity/repos","events_url":"https://api.github.com/users/electriccommunity/events{/privacy}","received_events_url":"https://api.github.com/users/electriccommunity/received_events","type":"Organization","site_admin":false},"repo":{"id":5116067,"name":"electriccommander","full_name":"electriccommunity/electriccommander","owner":{"login":"electriccommunity","id":1568775,"avatar_url":"https://avatars.githubusercontent.com/u/1568775?v=3","gravatar_id":"","url":"https://api.github.com/users/electriccommunity","html_url":"https://github.com/electriccommunity","followers_url":"https://api.github.com/users/electriccommunity/followers","following_url":"https://api.github.com/users/electriccommunity/following{/other_user}","gists_url":"https://api.github.com/users/electriccommunity/gists{/gist_id}","starred_url":"https://api.github.com/users/electriccommunity/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/electriccommunity/subscriptions","organizations_url":"https://api.github.com/users/electriccommunity/orgs","repos_url":"https://api.github.com/users/electriccommunity/repos","events_url":"https://api.github.com/users/electriccommunity/events{/privacy}","received_events_url":"https://api.github.com/users/electriccommunity/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/electriccommunity/electriccommander","description":"ElectricCommander automates and accelerates the application development (build-test-deploy) process and its supporting IT resources (physical, virtual, or public/private cloud).","fork":false,"url":"https://api.github.com/repos/electriccommunity/electriccommander","forks_url":"https://api.github.com/repos/electriccommunity/electriccommander/forks","keys_url":"https://api.github.com/repos/electriccommunity/electriccommander/keys{/key_id}","collaborators_url":"https://api.github.com/repos/electriccommunity/electriccommander/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/electriccommunity/electriccommander/teams","hooks_url":"https://api.github.com/repos/electriccommunity/electriccommander/hooks","issue_events_url":"https://api.github.com/repos/electriccommunity/electriccommander/issues/events{/number}","events_url":"https://api.github.com/repos/electriccommunity/electriccommander/events","assignees_url":"https://api.github.com/repos/electriccommunity/electriccommander/assignees{/user}","branches_url":"https://api.github.com/repos/electriccommunity/electriccommander/branches{/branch}","tags_url":"https://api.github.com/repos/electriccommunity/electriccommander/tags","blobs_url":"https://api.github.com/repos/electriccommunity/electriccommander/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/electriccommunity/electriccommander/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/electriccommunity/electriccommander/git/refs{/sha}","trees_url":"https://api.github.com/repos/electriccommunity/electriccommander/git/trees{/sha}","statuses_url":"https://api.github.com/repos/electriccommunity/electriccommander/statuses/{sha}","languages_url":"https://api.github.com/repos/electriccommunity/electriccommander/languages","stargazers_url":"https://api.github.com/repos/electriccommunity/electriccommander/stargazers","contributors_url":"https://api.github.com/repos/electriccommunity/electriccommander/contributors","subscribers_url":"https://api.github.com/repos/electriccommunity/electriccommander/subscribers","subscription_url":"https://api.github.com/repos/electriccommunity/electriccommander/subscription","commits_url":"https://api.github.com/repos/electriccommunity/electriccommander/commits{/sha}","git_commits_url":"https://api.github.com/repos/electriccommunity/electriccommander/git/commits{/sha}","comments_url":"https://api.github.com/repos/electriccommunity/electriccommander/comments{/number}","issue_comment_url":"https://api.github.com/repos/electriccommunity/electriccommander/issues/comments{/number}","contents_url":"https://api.github.com/repos/electriccommunity/electriccommander/contents/{+path}","compare_url":"https://api.github.com/repos/electriccommunity/electriccommander/compare/{base}...{head}","merges_url":"https://api.github.com/repos/electriccommunity/electriccommander/merges","archive_url":"https://api.github.com/repos/electriccommunity/electriccommander/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/electriccommunity/electriccommander/downloads","issues_url":"https://api.github.com/repos/electriccommunity/electriccommander/issues{/number}","pulls_url":"https://api.github.com/repos/electriccommunity/electriccommander/pulls{/number}","milestones_url":"https://api.github.com/repos/electriccommunity/electriccommander/milestones{/number}","notifications_url":"https://api.github.com/repos/electriccommunity/electriccommander/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/electriccommunity/electriccommander/labels{/name}","releases_url":"https://api.github.com/repos/electriccommunity/electriccommander/releases{/id}","created_at":"2012-07-19T21:47:04Z","updated_at":"2015-02-18T22:10:52Z","pushed_at":"2015-04-13T04:09:18Z","git_url":"git://github.com/electriccommunity/electriccommander.git","ssh_url":"git@github.com:electriccommunity/electriccommander.git","clone_url":"https://github.com/electriccommunity/electriccommander.git","svn_url":"https://github.com/electriccommunity/electriccommander","homepage":"http://community.electric-cloud.com/","size":155801,"stargazers_count":16,"watchers_count":16,"language":"Perl","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":25,"mirror_url":null,"open_issues_count":3,"forks":25,"open_issues":3,"watchers":16,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/electriccommunity/electriccommander/pulls/6"},"html":{"href":"https://github.com/electriccommunity/electriccommander/pull/6"},"issue":{"href":"https://api.github.com/repos/electriccommunity/electriccommander/issues/6"},"comments":{"href":"https://api.github.com/repos/electriccommunity/electriccommander/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/electriccommunity/electriccommander/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/electriccommunity/electriccommander/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/electriccommunity/electriccommander/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/electriccommunity/electriccommander/statuses/1e4d725478d53b29a416b8143aada7daefdbfd14"}}}}