コード例 #1
1
 def greetings_multiply(self, request):
   return Greeting(message=request.message * request.times)
コード例 #2
0
ファイル: hello.py プロジェクト: mshrkato/AtanTrainingCamp
    def post(self):
        name = self.request.get('name')
        age = int(self.request.get('age'))
        content = self.request.get('content')

        greeting = Greeting(name=name,age=age,content=content)

        greeting.put()

        self.redirect('/')
コード例 #3
0
    def post(self):
        name = self.request.get('name')
        age = int(self.request.get('age'))
        content = self.request.get('content')

        greeting = Greeting(name=name, age=age, content=content)

        greeting.put()

        self.redirect('/')
コード例 #4
0
ファイル: hello.py プロジェクト: mshrkato/AtanTrainingCamp
    def get(self):
        greetings = Greeting.all()

        values = {'greetings' : greetings}
        path = join(dirname(dirname(__file__)), 'template', 'hello.html')
        body = template.render(path, values)
        body = 'Hello world!'
        self.response.out.write(body)
コード例 #5
0
    def get(self):
        greetings = Greeting.all()

        values = {'greetings': greetings}
        path = join(dirname(dirname(__file__)), 'template', 'hello.html')
        body = template.render(path, values)
        body = 'Hello world!'
        self.response.out.write(body)
コード例 #6
0
"""Hello World API implemented using Google Cloud Endpoints.

Defined here are the ProtoRPC messages needed to define Schemas for methods
as well as those methods defined in an API.
"""

import endpoints
from protorpc import messages
from protorpc import message_types
from protorpc import remote

from models.greeting import Greeting
from models.greeting_collection import GreetingCollection

STORED_GREETINGS = GreetingCollection(items=[
    Greeting(message='hello world!'),
    Greeting(message='goodbye world!'),
])

hw_api = endpoints.api(name='helloworld', version='v1')

@hw_api.api_class(resource_name='helloworld')
class HelloWorldApi(remote.Service):
  """Helloworld API v1."""

  @endpoints.method(message_types.VoidMessage, GreetingCollection,
                    path='hellogreeting', http_method='GET',
                    name='greetings.listGreeting')
  def greetings_list(self, unused_request):
    return STORED_GREETINGS