uploading chapter 9 source code
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
# Copyright 2021 Google LLC
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
runtime: python39
|
||||
@@ -0,0 +1,30 @@
|
||||
|
||||
from flask import Flask
|
||||
from datetime import date, datetime
|
||||
|
||||
|
||||
# If `entrypoint` is not defined in app.yaml, App Engine will look for an app
|
||||
# called `app` in file `main.py`. This is the case in our yaml file
|
||||
app = Flask(__name__)
|
||||
|
||||
|
||||
@app.route('/')
|
||||
def welcome():
|
||||
return 'Welcome Python Geek! Use appropriate URI for date and time'
|
||||
|
||||
|
||||
@app.route('/date')
|
||||
def today():
|
||||
today = date.today()
|
||||
return "{date:" + today.strftime("%B %d, %Y") + '}'
|
||||
|
||||
|
||||
@app.route('/time')
|
||||
def time():
|
||||
now = datetime.now()
|
||||
return "{time:" + now.strftime("%H:%M:%S") + '}'
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
# For local testing
|
||||
app.run(host='127.0.0.1', port=8080, debug=True)
|
||||
@@ -0,0 +1 @@
|
||||
Flask==2.0.1
|
||||
Reference in New Issue
Block a user