3.
What is GAE?
● Google App Engine lets you run web
applications on Google’s infrastructure
● App Engine applications are easy to build,
maintain, and scale as traffic and data
storage needs grow
● With App Engine, there are no servers to
maintain
● You can serve your app from your domain
name (such as http://www.example.com/) or
using a free name on the appspot.com

4.
Benefits of GAE
● You only pay for what you use
● No set-up costs and no recurring fees
● The resources your application uses, such
as storage and bandwidth, are measured by
the gigabyte, and billed at competitive rates
● You can control the maximum amounts of
resources your app can consume
● All applications can use up to 1 GB of
storage and enough CPU and bandwidth to
support an efficient app serving around 5
million page views a month, absolutely free

11.
Google Authentication on GAE
● To make API calls access private data, the
user that has access to the private data must
grant your application access
● Therefore, your application must be
authenticated, the user must grant access
for your application, and the user must be
authenticated in order to grant that access
● All of this is accomplished with OAuth 2.0
and libraries written for it.

12.
Google API’s Client Library for Python
● The Google APIs Client Library for Python has special
support for Google App Engine applications
● There are two decorator classes to choose from:
•
OAuth2Decorator: Use the OAuth2Decorator class to
contruct a decorator with your client ID and secret.
•
OAuth2DecoratorFromClientSecrets: Use the
OAuth2DecoratorFromClientSecrets class to contruct a
decorator using a client_secrets.json file described in
the flow_from_secrets() section of the OAuth 2.0 page

14.
Sample Authentication Code
In the following code snippet, the OAuth2Decorator class
is used to create an oauth_required decorator, and the
decorator is applied to a function that accesses the
Google Calendar API
decorator = OAuth2Decorator(
client_id='your_client_id',
client_secret='your_client_secret',
scope='https://www.googleapis.com/auth/calendar')
service = build('calendar', 'v3')
class MainHandler(webapp.RequestHandler):
@decorator.oauth_required
def get(self):
# Get the authorized Http object created by the
decorator.
http = decorator.http()
...

15.
How to get Client ID and Client
Secret
1. Go to http://code.google.com/apis/console
2. Go to API Access
- Click button “Create Another Client ID...”
3. Fill in information about the application

20.
Using Google Cloud SQL
● Google Cloud SQL is a web service that allows you to
create, configure, and use relational databases that live
in Google's cloud
● By offering the capabilities of a familiar MySQL
database, the service enables you to easily move your
data, applications, and services in and out of the cloud
● There is a range of configurations from small instances
costing just $0.025 per hour up to high end instances
with 16GB of RAM and 100GB of data storage.

21.
How to Create a Instance on Cloud SQL
1. Go to Google Cloud Console at http://cloud.google.com
2. Choose project that we want to use Cloud SQL
3. At the side menu, choose Cloud SQL
4. Then click button New Instance

24.
Accessing Cloud SQL (3 of 4)
If you find that there is the problem, “The rdbms API is not
available because the MySQLdb library could not be
loaded”,
●
Type import MySQLdb in file dev_appserver.py
6. You can use any other SQL commands such as
INSERT or DELETE with the function cursor.execute()
cursor.execute("INSERT INTO comment
(comment,name) VALUES (%s,%s)", (comment,
name));
conn.commit();
7. After you finish with all tasks with cloud SQL, you
should issue function close()
conn.close();

25.
Sample Result
● As the user type comment, and name and click button
Insert data, the app will insert data into Cloud SQL, and
then display the inserted data in the table on the page

26.
Conclusion
● Google App Engine (GAE) will help
developers to make it easy to build scalable
applications
● There are two favorite languages for
implementing apps on GAE
○
Python and Java
● To call Google API to access data, need to
use OAuth 2.0
● To leverage existing relational databases,
should use Cloud SQL