{"action":"created","comment":{"url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/pulls/comments/88376736","pull_request_review_id":8951753,"id":88376736,"diff_hunk":"@@ -0,0 +1,123 @@\n+# Copyright 2016 Google Inc. All Rights Reserved.\n+#\n+# Licensed under the Apache License, Version 2.0 (the \"License\");\n+# you may not use this file except in compliance with the License.\n+# You may obtain a copy of the License at\n+#\n+#     http://www.apache.org/licenses/LICENSE-2.0\n+#\n+# Unless required by applicable law or agreed to in writing, software\n+# distributed under the License is distributed on an \"AS IS\" BASIS,\n+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+# See the License for the specific language governing permissions and\n+# limitations under the License.\n+\n+\"\"\"The Python gRPC Bookstore Server Example.\"\"\"\n+\n+import argparse\n+import grpc\n+import status\n+import time\n+\n+import bookstore\n+import bookstore_pb2\n+\n+from google.protobuf import struct_pb2\n+\n+_ONE_DAY_IN_SECONDS = 60 * 60 * 24\n+\n+\n+class BookstoreServicer(bookstore_pb2.BetaBookstoreServicer):\n+  \"\"\"Implements the bookstore API server.\"\"\"\n+  def __init__(self, store):\n+    self._store = store\n+\n+  def ListShelves(self, unused_request, context):\n+    with status.context(context):\n+      response = bookstore_pb2.ListShelvesResponse()\n+      response.shelves.extend(self._store.list_shelves())\n+      return response\n+\n+  def CreateShelf(self, request, context):\n+    with status.context(context):\n+      (shelf, _) = self._store.create_shelf(request.shelf)\n+      return shelf\n+\n+  def GetShelf(self, request, context):\n+    with status.context(context):\n+      return self._store.get_shelf(request.shelf)\n+\n+  def DeleteShelf(self, request, context):\n+    with status.context(context):\n+      self._store.delete_shelf(request.shelf)\n+      return struct_pb2.Value()\n+\n+  def ListBooks(self, request, context):\n+    with status.context(context):\n+      response = bookstore_pb2.ListBooksResponse()\n+      response.books.extend(self._store.list_books(request.shelf))\n+      return response\n+\n+  def CreateBook(self, request, context):\n+    with status.context(context):\n+      return self._store.create_book(request.shelf, request.book)\n+\n+  def GetBook(self, request, context):\n+    with status.context(context):\n+      return self._store.get_book(request.shelf, request.book)\n+\n+  def DeleteBook(self, request, context):\n+    with status.context(context):\n+      self._store.delete_book(request.shelf, request.book)\n+      return struct_pb2.Value()\n+\n+\n+def create_sample_bookstore():\n+  \"\"\"Creates a Bookstore with some initial sample data.\"\"\"\n+  store = bookstore.Bookstore()\n+\n+  shelf = bookstore_pb2.Shelf()\n+  shelf.theme = \"Fiction\"\n+  (_, fiction) = store.create_shelf(shelf)\n+\n+  book = bookstore_pb2.Book()\n+  book.title = \"REAMDE\"","path":"endpoints/bookstore-grpc/bookstore_server.py","position":84,"original_position":84,"commit_id":"54f227306999f2065de18e94ce62376af88e448d","original_commit_id":"54f227306999f2065de18e94ce62376af88e448d","user":{"login":"wlu2016","id":15929996,"avatar_url":"https://avatars.githubusercontent.com/u/15929996?v=3","gravatar_id":"","url":"https://api.github.com/users/wlu2016","html_url":"https://github.com/wlu2016","followers_url":"https://api.github.com/users/wlu2016/followers","following_url":"https://api.github.com/users/wlu2016/following{/other_user}","gists_url":"https://api.github.com/users/wlu2016/gists{/gist_id}","starred_url":"https://api.github.com/users/wlu2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wlu2016/subscriptions","organizations_url":"https://api.github.com/users/wlu2016/orgs","repos_url":"https://api.github.com/users/wlu2016/repos","events_url":"https://api.github.com/users/wlu2016/events{/privacy}","received_events_url":"https://api.github.com/users/wlu2016/received_events","type":"User","site_admin":false},"body":"wow, nice catch :)","created_at":"2016-11-17T02:38:42Z","updated_at":"2016-11-17T02:38:42Z","html_url":"https://github.com/GoogleCloudPlatform/python-docs-samples/pull/660#discussion_r88376736","pull_request_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/pulls/660","_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/pulls/comments/88376736"},"html":{"href":"https://github.com/GoogleCloudPlatform/python-docs-samples/pull/660#discussion_r88376736"},"pull_request":{"href":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/pulls/660"}}},"pull_request":{"url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/pulls/660","id":93909311,"html_url":"https://github.com/GoogleCloudPlatform/python-docs-samples/pull/660","diff_url":"https://github.com/GoogleCloudPlatform/python-docs-samples/pull/660.diff","patch_url":"https://github.com/GoogleCloudPlatform/python-docs-samples/pull/660.patch","issue_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/issues/660","number":660,"state":"open","locked":false,"title":"add grpc bookstore python samples","user":{"login":"wlu2016","id":15929996,"avatar_url":"https://avatars.githubusercontent.com/u/15929996?v=3","gravatar_id":"","url":"https://api.github.com/users/wlu2016","html_url":"https://github.com/wlu2016","followers_url":"https://api.github.com/users/wlu2016/followers","following_url":"https://api.github.com/users/wlu2016/following{/other_user}","gists_url":"https://api.github.com/users/wlu2016/gists{/gist_id}","starred_url":"https://api.github.com/users/wlu2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wlu2016/subscriptions","organizations_url":"https://api.github.com/users/wlu2016/orgs","repos_url":"https://api.github.com/users/wlu2016/repos","events_url":"https://api.github.com/users/wlu2016/events{/privacy}","received_events_url":"https://api.github.com/users/wlu2016/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-16T06:36:17Z","updated_at":"2016-11-17T02:38:42Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a2d66604c92a8f8b87b3be0214c8060a62aaeb07","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/pulls/660/commits","review_comments_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/pulls/660/comments","review_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/pulls/comments{/number}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/issues/660/comments","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/statuses/54f227306999f2065de18e94ce62376af88e448d","head":{"label":"wlu2016:master","ref":"master","sha":"54f227306999f2065de18e94ce62376af88e448d","user":{"login":"wlu2016","id":15929996,"avatar_url":"https://avatars.githubusercontent.com/u/15929996?v=3","gravatar_id":"","url":"https://api.github.com/users/wlu2016","html_url":"https://github.com/wlu2016","followers_url":"https://api.github.com/users/wlu2016/followers","following_url":"https://api.github.com/users/wlu2016/following{/other_user}","gists_url":"https://api.github.com/users/wlu2016/gists{/gist_id}","starred_url":"https://api.github.com/users/wlu2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wlu2016/subscriptions","organizations_url":"https://api.github.com/users/wlu2016/orgs","repos_url":"https://api.github.com/users/wlu2016/repos","events_url":"https://api.github.com/users/wlu2016/events{/privacy}","received_events_url":"https://api.github.com/users/wlu2016/received_events","type":"User","site_admin":false},"repo":{"id":73889237,"name":"python-docs-samples","full_name":"wlu2016/python-docs-samples","owner":{"login":"wlu2016","id":15929996,"avatar_url":"https://avatars.githubusercontent.com/u/15929996?v=3","gravatar_id":"","url":"https://api.github.com/users/wlu2016","html_url":"https://github.com/wlu2016","followers_url":"https://api.github.com/users/wlu2016/followers","following_url":"https://api.github.com/users/wlu2016/following{/other_user}","gists_url":"https://api.github.com/users/wlu2016/gists{/gist_id}","starred_url":"https://api.github.com/users/wlu2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wlu2016/subscriptions","organizations_url":"https://api.github.com/users/wlu2016/orgs","repos_url":"https://api.github.com/users/wlu2016/repos","events_url":"https://api.github.com/users/wlu2016/events{/privacy}","received_events_url":"https://api.github.com/users/wlu2016/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wlu2016/python-docs-samples","description":"Code samples used on cloud.google.com","fork":true,"url":"https://api.github.com/repos/wlu2016/python-docs-samples","forks_url":"https://api.github.com/repos/wlu2016/python-docs-samples/forks","keys_url":"https://api.github.com/repos/wlu2016/python-docs-samples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wlu2016/python-docs-samples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wlu2016/python-docs-samples/teams","hooks_url":"https://api.github.com/repos/wlu2016/python-docs-samples/hooks","issue_events_url":"https://api.github.com/repos/wlu2016/python-docs-samples/issues/events{/number}","events_url":"https://api.github.com/repos/wlu2016/python-docs-samples/events","assignees_url":"https://api.github.com/repos/wlu2016/python-docs-samples/assignees{/user}","branches_url":"https://api.github.com/repos/wlu2016/python-docs-samples/branches{/branch}","tags_url":"https://api.github.com/repos/wlu2016/python-docs-samples/tags","blobs_url":"https://api.github.com/repos/wlu2016/python-docs-samples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wlu2016/python-docs-samples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wlu2016/python-docs-samples/git/refs{/sha}","trees_url":"https://api.github.com/repos/wlu2016/python-docs-samples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wlu2016/python-docs-samples/statuses/{sha}","languages_url":"https://api.github.com/repos/wlu2016/python-docs-samples/languages","stargazers_url":"https://api.github.com/repos/wlu2016/python-docs-samples/stargazers","contributors_url":"https://api.github.com/repos/wlu2016/python-docs-samples/contributors","subscribers_url":"https://api.github.com/repos/wlu2016/python-docs-samples/subscribers","subscription_url":"https://api.github.com/repos/wlu2016/python-docs-samples/subscription","commits_url":"https://api.github.com/repos/wlu2016/python-docs-samples/commits{/sha}","git_commits_url":"https://api.github.com/repos/wlu2016/python-docs-samples/git/commits{/sha}","comments_url":"https://api.github.com/repos/wlu2016/python-docs-samples/comments{/number}","issue_comment_url":"https://api.github.com/repos/wlu2016/python-docs-samples/issues/comments{/number}","contents_url":"https://api.github.com/repos/wlu2016/python-docs-samples/contents/{+path}","compare_url":"https://api.github.com/repos/wlu2016/python-docs-samples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wlu2016/python-docs-samples/merges","archive_url":"https://api.github.com/repos/wlu2016/python-docs-samples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wlu2016/python-docs-samples/downloads","issues_url":"https://api.github.com/repos/wlu2016/python-docs-samples/issues{/number}","pulls_url":"https://api.github.com/repos/wlu2016/python-docs-samples/pulls{/number}","milestones_url":"https://api.github.com/repos/wlu2016/python-docs-samples/milestones{/number}","notifications_url":"https://api.github.com/repos/wlu2016/python-docs-samples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wlu2016/python-docs-samples/labels{/name}","releases_url":"https://api.github.com/repos/wlu2016/python-docs-samples/releases{/id}","deployments_url":"https://api.github.com/repos/wlu2016/python-docs-samples/deployments","created_at":"2016-11-16T06:03:15Z","updated_at":"2016-11-16T06:03:17Z","pushed_at":"2016-11-17T00:10:50Z","git_url":"git://github.com/wlu2016/python-docs-samples.git","ssh_url":"git@github.com:wlu2016/python-docs-samples.git","clone_url":"https://github.com/wlu2016/python-docs-samples.git","svn_url":"https://github.com/wlu2016/python-docs-samples","homepage":"","size":3719,"stargazers_count":0,"watchers_count":0,"language":"Python","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":"GoogleCloudPlatform:master","ref":"master","sha":"a2962f85acc827d34de902ea736a0d3329c67b95","user":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"repo":{"id":35065876,"name":"python-docs-samples","full_name":"GoogleCloudPlatform/python-docs-samples","owner":{"login":"GoogleCloudPlatform","id":2810941,"avatar_url":"https://avatars.githubusercontent.com/u/2810941?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCloudPlatform","html_url":"https://github.com/GoogleCloudPlatform","followers_url":"https://api.github.com/users/GoogleCloudPlatform/followers","following_url":"https://api.github.com/users/GoogleCloudPlatform/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCloudPlatform/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCloudPlatform/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCloudPlatform/subscriptions","organizations_url":"https://api.github.com/users/GoogleCloudPlatform/orgs","repos_url":"https://api.github.com/users/GoogleCloudPlatform/repos","events_url":"https://api.github.com/users/GoogleCloudPlatform/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCloudPlatform/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/GoogleCloudPlatform/python-docs-samples","description":"Code samples used on cloud.google.com","fork":false,"url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples","forks_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/forks","keys_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/keys{/key_id}","collaborators_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/teams","hooks_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/hooks","issue_events_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/issues/events{/number}","events_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/events","assignees_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/assignees{/user}","branches_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/branches{/branch}","tags_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/tags","blobs_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/git/refs{/sha}","trees_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/git/trees{/sha}","statuses_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/statuses/{sha}","languages_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/languages","stargazers_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/stargazers","contributors_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/contributors","subscribers_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/subscribers","subscription_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/subscription","commits_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/commits{/sha}","git_commits_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/git/commits{/sha}","comments_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/comments{/number}","issue_comment_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/issues/comments{/number}","contents_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/contents/{+path}","compare_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/compare/{base}...{head}","merges_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/merges","archive_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/downloads","issues_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/issues{/number}","pulls_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/pulls{/number}","milestones_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/milestones{/number}","notifications_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/labels{/name}","releases_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/releases{/id}","deployments_url":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/deployments","created_at":"2015-05-04T23:26:13Z","updated_at":"2016-11-16T08:24:22Z","pushed_at":"2016-11-17T00:46:05Z","git_url":"git://github.com/GoogleCloudPlatform/python-docs-samples.git","ssh_url":"git@github.com:GoogleCloudPlatform/python-docs-samples.git","clone_url":"https://github.com/GoogleCloudPlatform/python-docs-samples.git","svn_url":"https://github.com/GoogleCloudPlatform/python-docs-samples","homepage":"","size":4735,"stargazers_count":399,"watchers_count":399,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":421,"mirror_url":null,"open_issues_count":19,"forks":421,"open_issues":19,"watchers":399,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/pulls/660"},"html":{"href":"https://github.com/GoogleCloudPlatform/python-docs-samples/pull/660"},"issue":{"href":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/issues/660"},"comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/issues/660/comments"},"review_comments":{"href":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/pulls/660/comments"},"review_comment":{"href":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/pulls/660/commits"},"statuses":{"href":"https://api.github.com/repos/GoogleCloudPlatform/python-docs-samples/statuses/54f227306999f2065de18e94ce62376af88e448d"}}}}
{"actor":{"display_login":"wlu2016"}}