{"action":"created","comment":{"url":"https://api.github.com/repos/openwhisk/openwhisk/pulls/comments/65618825","id":65618825,"diff_hunk":"@@ -323,6 +323,102 @@ Several utility actions are provided in a package called `/whisk.system/util` th\n \n   In the result, you see that the lines are sorted.\n \n+## Creating Python actions\n+\n+The process of creating Python actions is similar to that of JavaScript actions. The following sections guide you through creating and invoking a single Python action, and adding parameters to that action.\n+\n+### Creating and invoking an action\n+\n+An action is simply a top-level Python function, which means it is necessary to have a method named 'main'. For example, create a file called\n+`hello.py` with the following content:\n+\n+```\n+    def main(dict):\n+        name = dict.get('name', \"Stranger\")\n+        greeting = \"Hello \" + name + \".\"\n+        print(greeting)\n+        return {\"greeting\": greeting}\n+```\n+\n+Note that just like JavaScript actions, Python actions always consume a dictionary and produce a\n+dictionary. The simplicity of Python is that there is no need to define the type of the parameter\n+before using it. Parameters are able to name and use as the expected type in the code. As in the\n+above code, a value for the key \"name\" is expected. If this key is not available, \"Stranger\" will\n+be taken as the default value.\n+\n+You can create a OpenWhisk action called `helloPython` from this function as\n+follows:\n+\n+```\n+$ wsk action create helloPython hello.py\n+```\n+\n+When using the command line and a `.py` source file, you do not need to\n+specify that you are creating a Python action (as opposed to a JavaScript action);\n+the tool determines that from the file extension.\n+\n+You can specify the parameters in terms of the key-value pairs. The format is to add\n+one more option \"--param <key> <value>\". With each option \"--param\", you can input one\n+key-value pair. For example, you can input a value \"World\" for the key \"name\" by typing\n+\"--param name World\":\n+\n+```\n+$ wsk action invoke --blocking --result helloPython --param name World\n+```\n+\n+The result of the above command will be:\n+```\n+  {\n+      \"greeting\": \"Hello World.\"\n+  }\n+```\n+","path":"docs/actions.md","position":53,"original_position":53,"commit_id":"44d6649004b70e78e40bf58416931051308bbf03","original_commit_id":"44d6649004b70e78e40bf58416931051308bbf03","user":{"login":"rabbah","id":4959922,"avatar_url":"https://avatars.githubusercontent.com/u/4959922?v=3","gravatar_id":"","url":"https://api.github.com/users/rabbah","html_url":"https://github.com/rabbah","followers_url":"https://api.github.com/users/rabbah/followers","following_url":"https://api.github.com/users/rabbah/following{/other_user}","gists_url":"https://api.github.com/users/rabbah/gists{/gist_id}","starred_url":"https://api.github.com/users/rabbah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rabbah/subscriptions","organizations_url":"https://api.github.com/users/rabbah/orgs","repos_url":"https://api.github.com/users/rabbah/repos","events_url":"https://api.github.com/users/rabbah/events{/privacy}","received_events_url":"https://api.github.com/users/rabbah/received_events","type":"User","site_admin":false},"body":"Isn't the following redundant with existing explanations for passing parameters? I don't think it is necessary to repeat it here specially since it is _not_ specific to any action language choice.","created_at":"2016-06-02T21:08:45Z","updated_at":"2016-06-02T21:08:45Z","html_url":"https://github.com/openwhisk/openwhisk/pull/494#discussion_r65618825","pull_request_url":"https://api.github.com/repos/openwhisk/openwhisk/pulls/494","_links":{"self":{"href":"https://api.github.com/repos/openwhisk/openwhisk/pulls/comments/65618825"},"html":{"href":"https://github.com/openwhisk/openwhisk/pull/494#discussion_r65618825"},"pull_request":{"href":"https://api.github.com/repos/openwhisk/openwhisk/pulls/494"}}},"pull_request":{"url":"https://api.github.com/repos/openwhisk/openwhisk/pulls/494","id":71142194,"html_url":"https://github.com/openwhisk/openwhisk/pull/494","diff_url":"https://github.com/openwhisk/openwhisk/pull/494.diff","patch_url":"https://github.com/openwhisk/openwhisk/pull/494.patch","issue_url":"https://api.github.com/repos/openwhisk/openwhisk/issues/494","number":494,"state":"closed","locked":false,"title":"Add the explanation on how to add a Python action","user":{"login":"houshengbo","id":1542989,"avatar_url":"https://avatars.githubusercontent.com/u/1542989?v=3","gravatar_id":"","url":"https://api.github.com/users/houshengbo","html_url":"https://github.com/houshengbo","followers_url":"https://api.github.com/users/houshengbo/followers","following_url":"https://api.github.com/users/houshengbo/following{/other_user}","gists_url":"https://api.github.com/users/houshengbo/gists{/gist_id}","starred_url":"https://api.github.com/users/houshengbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houshengbo/subscriptions","organizations_url":"https://api.github.com/users/houshengbo/orgs","repos_url":"https://api.github.com/users/houshengbo/repos","events_url":"https://api.github.com/users/houshengbo/events{/privacy}","received_events_url":"https://api.github.com/users/houshengbo/received_events","type":"User","site_admin":false},"body":"Closes-Bug: #376","created_at":"2016-05-24T00:40:07Z","updated_at":"2016-06-02T21:08:45Z","closed_at":"2016-06-02T20:37:47Z","merged_at":"2016-06-02T20:37:47Z","merge_commit_sha":"44d6649004b70e78e40bf58416931051308bbf03","assignee":{"login":"ioana-blue","id":17202292,"avatar_url":"https://avatars.githubusercontent.com/u/17202292?v=3","gravatar_id":"","url":"https://api.github.com/users/ioana-blue","html_url":"https://github.com/ioana-blue","followers_url":"https://api.github.com/users/ioana-blue/followers","following_url":"https://api.github.com/users/ioana-blue/following{/other_user}","gists_url":"https://api.github.com/users/ioana-blue/gists{/gist_id}","starred_url":"https://api.github.com/users/ioana-blue/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ioana-blue/subscriptions","organizations_url":"https://api.github.com/users/ioana-blue/orgs","repos_url":"https://api.github.com/users/ioana-blue/repos","events_url":"https://api.github.com/users/ioana-blue/events{/privacy}","received_events_url":"https://api.github.com/users/ioana-blue/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/openwhisk/openwhisk/pulls/494/commits","review_comments_url":"https://api.github.com/repos/openwhisk/openwhisk/pulls/494/comments","review_comment_url":"https://api.github.com/repos/openwhisk/openwhisk/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openwhisk/openwhisk/issues/494/comments","statuses_url":"https://api.github.com/repos/openwhisk/openwhisk/statuses/44d6649004b70e78e40bf58416931051308bbf03","head":{"label":"houshengbo:Bug376","ref":"Bug376","sha":"44d6649004b70e78e40bf58416931051308bbf03","user":{"login":"houshengbo","id":1542989,"avatar_url":"https://avatars.githubusercontent.com/u/1542989?v=3","gravatar_id":"","url":"https://api.github.com/users/houshengbo","html_url":"https://github.com/houshengbo","followers_url":"https://api.github.com/users/houshengbo/followers","following_url":"https://api.github.com/users/houshengbo/following{/other_user}","gists_url":"https://api.github.com/users/houshengbo/gists{/gist_id}","starred_url":"https://api.github.com/users/houshengbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houshengbo/subscriptions","organizations_url":"https://api.github.com/users/houshengbo/orgs","repos_url":"https://api.github.com/users/houshengbo/repos","events_url":"https://api.github.com/users/houshengbo/events{/privacy}","received_events_url":"https://api.github.com/users/houshengbo/received_events","type":"User","site_admin":false},"repo":{"id":55419392,"name":"openwhisk","full_name":"houshengbo/openwhisk","owner":{"login":"houshengbo","id":1542989,"avatar_url":"https://avatars.githubusercontent.com/u/1542989?v=3","gravatar_id":"","url":"https://api.github.com/users/houshengbo","html_url":"https://github.com/houshengbo","followers_url":"https://api.github.com/users/houshengbo/followers","following_url":"https://api.github.com/users/houshengbo/following{/other_user}","gists_url":"https://api.github.com/users/houshengbo/gists{/gist_id}","starred_url":"https://api.github.com/users/houshengbo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houshengbo/subscriptions","organizations_url":"https://api.github.com/users/houshengbo/orgs","repos_url":"https://api.github.com/users/houshengbo/repos","events_url":"https://api.github.com/users/houshengbo/events{/privacy}","received_events_url":"https://api.github.com/users/houshengbo/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/houshengbo/openwhisk","description":"OpenWhisk is a cloud-first distributed event-based programming service.","fork":true,"url":"https://api.github.com/repos/houshengbo/openwhisk","forks_url":"https://api.github.com/repos/houshengbo/openwhisk/forks","keys_url":"https://api.github.com/repos/houshengbo/openwhisk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/houshengbo/openwhisk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/houshengbo/openwhisk/teams","hooks_url":"https://api.github.com/repos/houshengbo/openwhisk/hooks","issue_events_url":"https://api.github.com/repos/houshengbo/openwhisk/issues/events{/number}","events_url":"https://api.github.com/repos/houshengbo/openwhisk/events","assignees_url":"https://api.github.com/repos/houshengbo/openwhisk/assignees{/user}","branches_url":"https://api.github.com/repos/houshengbo/openwhisk/branches{/branch}","tags_url":"https://api.github.com/repos/houshengbo/openwhisk/tags","blobs_url":"https://api.github.com/repos/houshengbo/openwhisk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/houshengbo/openwhisk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/houshengbo/openwhisk/git/refs{/sha}","trees_url":"https://api.github.com/repos/houshengbo/openwhisk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/houshengbo/openwhisk/statuses/{sha}","languages_url":"https://api.github.com/repos/houshengbo/openwhisk/languages","stargazers_url":"https://api.github.com/repos/houshengbo/openwhisk/stargazers","contributors_url":"https://api.github.com/repos/houshengbo/openwhisk/contributors","subscribers_url":"https://api.github.com/repos/houshengbo/openwhisk/subscribers","subscription_url":"https://api.github.com/repos/houshengbo/openwhisk/subscription","commits_url":"https://api.github.com/repos/houshengbo/openwhisk/commits{/sha}","git_commits_url":"https://api.github.com/repos/houshengbo/openwhisk/git/commits{/sha}","comments_url":"https://api.github.com/repos/houshengbo/openwhisk/comments{/number}","issue_comment_url":"https://api.github.com/repos/houshengbo/openwhisk/issues/comments{/number}","contents_url":"https://api.github.com/repos/houshengbo/openwhisk/contents/{+path}","compare_url":"https://api.github.com/repos/houshengbo/openwhisk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/houshengbo/openwhisk/merges","archive_url":"https://api.github.com/repos/houshengbo/openwhisk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/houshengbo/openwhisk/downloads","issues_url":"https://api.github.com/repos/houshengbo/openwhisk/issues{/number}","pulls_url":"https://api.github.com/repos/houshengbo/openwhisk/pulls{/number}","milestones_url":"https://api.github.com/repos/houshengbo/openwhisk/milestones{/number}","notifications_url":"https://api.github.com/repos/houshengbo/openwhisk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/houshengbo/openwhisk/labels{/name}","releases_url":"https://api.github.com/repos/houshengbo/openwhisk/releases{/id}","deployments_url":"https://api.github.com/repos/houshengbo/openwhisk/deployments","created_at":"2016-04-04T14:45:51Z","updated_at":"2016-04-04T14:45:53Z","pushed_at":"2016-06-02T20:54:46Z","git_url":"git://github.com/houshengbo/openwhisk.git","ssh_url":"git@github.com:houshengbo/openwhisk.git","clone_url":"https://github.com/houshengbo/openwhisk.git","svn_url":"https://github.com/houshengbo/openwhisk","homepage":"","size":40991,"stargazers_count":0,"watchers_count":0,"language":"Scala","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":"openwhisk:master","ref":"master","sha":"969eb0ec2e8156f8b15f68c8b7f430f34b875f95","user":{"login":"openwhisk","id":16900235,"avatar_url":"https://avatars.githubusercontent.com/u/16900235?v=3","gravatar_id":"","url":"https://api.github.com/users/openwhisk","html_url":"https://github.com/openwhisk","followers_url":"https://api.github.com/users/openwhisk/followers","following_url":"https://api.github.com/users/openwhisk/following{/other_user}","gists_url":"https://api.github.com/users/openwhisk/gists{/gist_id}","starred_url":"https://api.github.com/users/openwhisk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openwhisk/subscriptions","organizations_url":"https://api.github.com/users/openwhisk/orgs","repos_url":"https://api.github.com/users/openwhisk/repos","events_url":"https://api.github.com/users/openwhisk/events{/privacy}","received_events_url":"https://api.github.com/users/openwhisk/received_events","type":"Organization","site_admin":false},"repo":{"id":52039373,"name":"openwhisk","full_name":"openwhisk/openwhisk","owner":{"login":"openwhisk","id":16900235,"avatar_url":"https://avatars.githubusercontent.com/u/16900235?v=3","gravatar_id":"","url":"https://api.github.com/users/openwhisk","html_url":"https://github.com/openwhisk","followers_url":"https://api.github.com/users/openwhisk/followers","following_url":"https://api.github.com/users/openwhisk/following{/other_user}","gists_url":"https://api.github.com/users/openwhisk/gists{/gist_id}","starred_url":"https://api.github.com/users/openwhisk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openwhisk/subscriptions","organizations_url":"https://api.github.com/users/openwhisk/orgs","repos_url":"https://api.github.com/users/openwhisk/repos","events_url":"https://api.github.com/users/openwhisk/events{/privacy}","received_events_url":"https://api.github.com/users/openwhisk/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openwhisk/openwhisk","description":"OpenWhisk is a cloud-first distributed event-based programming service.","fork":false,"url":"https://api.github.com/repos/openwhisk/openwhisk","forks_url":"https://api.github.com/repos/openwhisk/openwhisk/forks","keys_url":"https://api.github.com/repos/openwhisk/openwhisk/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openwhisk/openwhisk/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openwhisk/openwhisk/teams","hooks_url":"https://api.github.com/repos/openwhisk/openwhisk/hooks","issue_events_url":"https://api.github.com/repos/openwhisk/openwhisk/issues/events{/number}","events_url":"https://api.github.com/repos/openwhisk/openwhisk/events","assignees_url":"https://api.github.com/repos/openwhisk/openwhisk/assignees{/user}","branches_url":"https://api.github.com/repos/openwhisk/openwhisk/branches{/branch}","tags_url":"https://api.github.com/repos/openwhisk/openwhisk/tags","blobs_url":"https://api.github.com/repos/openwhisk/openwhisk/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openwhisk/openwhisk/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openwhisk/openwhisk/git/refs{/sha}","trees_url":"https://api.github.com/repos/openwhisk/openwhisk/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openwhisk/openwhisk/statuses/{sha}","languages_url":"https://api.github.com/repos/openwhisk/openwhisk/languages","stargazers_url":"https://api.github.com/repos/openwhisk/openwhisk/stargazers","contributors_url":"https://api.github.com/repos/openwhisk/openwhisk/contributors","subscribers_url":"https://api.github.com/repos/openwhisk/openwhisk/subscribers","subscription_url":"https://api.github.com/repos/openwhisk/openwhisk/subscription","commits_url":"https://api.github.com/repos/openwhisk/openwhisk/commits{/sha}","git_commits_url":"https://api.github.com/repos/openwhisk/openwhisk/git/commits{/sha}","comments_url":"https://api.github.com/repos/openwhisk/openwhisk/comments{/number}","issue_comment_url":"https://api.github.com/repos/openwhisk/openwhisk/issues/comments{/number}","contents_url":"https://api.github.com/repos/openwhisk/openwhisk/contents/{+path}","compare_url":"https://api.github.com/repos/openwhisk/openwhisk/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openwhisk/openwhisk/merges","archive_url":"https://api.github.com/repos/openwhisk/openwhisk/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openwhisk/openwhisk/downloads","issues_url":"https://api.github.com/repos/openwhisk/openwhisk/issues{/number}","pulls_url":"https://api.github.com/repos/openwhisk/openwhisk/pulls{/number}","milestones_url":"https://api.github.com/repos/openwhisk/openwhisk/milestones{/number}","notifications_url":"https://api.github.com/repos/openwhisk/openwhisk/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openwhisk/openwhisk/labels{/name}","releases_url":"https://api.github.com/repos/openwhisk/openwhisk/releases{/id}","deployments_url":"https://api.github.com/repos/openwhisk/openwhisk/deployments","created_at":"2016-02-18T21:16:19Z","updated_at":"2016-06-02T19:47:05Z","pushed_at":"2016-06-02T20:57:31Z","git_url":"git://github.com/openwhisk/openwhisk.git","ssh_url":"git@github.com:openwhisk/openwhisk.git","clone_url":"https://github.com/openwhisk/openwhisk.git","svn_url":"https://github.com/openwhisk/openwhisk","homepage":"","size":42135,"stargazers_count":295,"watchers_count":295,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":90,"mirror_url":null,"open_issues_count":189,"forks":90,"open_issues":189,"watchers":295,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openwhisk/openwhisk/pulls/494"},"html":{"href":"https://github.com/openwhisk/openwhisk/pull/494"},"issue":{"href":"https://api.github.com/repos/openwhisk/openwhisk/issues/494"},"comments":{"href":"https://api.github.com/repos/openwhisk/openwhisk/issues/494/comments"},"review_comments":{"href":"https://api.github.com/repos/openwhisk/openwhisk/pulls/494/comments"},"review_comment":{"href":"https://api.github.com/repos/openwhisk/openwhisk/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openwhisk/openwhisk/pulls/494/commits"},"statuses":{"href":"https://api.github.com/repos/openwhisk/openwhisk/statuses/44d6649004b70e78e40bf58416931051308bbf03"}}}}
{"actor":{"display_login":"rabbah"}}