diff --git a/appengine/flexible/analytics/app.yaml b/appengine/flexible/analytics/app.yaml index 16bffdae113..e4d6df6b018 100644 --- a/appengine/flexible/analytics/app.yaml +++ b/appengine/flexible/analytics/app.yaml @@ -5,7 +5,7 @@ entrypoint: gunicorn -b :$PORT main:app runtime_config: python_version: 3 -#[START env] +#[START gae_flex_analytics_env_variables] env_variables: GA_TRACKING_ID: your-tracking-id -#[END env] +#[END gae_flex_analytics_env_variables] diff --git a/appengine/flexible/analytics/main.py b/appengine/flexible/analytics/main.py index 1c9fb9a7168..9c7314e441d 100644 --- a/appengine/flexible/analytics/main.py +++ b/appengine/flexible/analytics/main.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# [START app] +# [START gae_flex_analytics_track_event] import logging import os @@ -71,4 +71,4 @@ def server_error(e): # This is used when running locally. Gunicorn is used to run the # application on Google App Engine. See entrypoint in app.yaml. app.run(host='127.0.0.1', port=8080, debug=True) -# [END app] +# [END gae_flex_analytics_track_event] diff --git a/appengine/flexible/cloudsql/app.yaml b/appengine/flexible/cloudsql/app.yaml index 377c8a4b171..4d53bd6aa01 100644 --- a/appengine/flexible/cloudsql/app.yaml +++ b/appengine/flexible/cloudsql/app.yaml @@ -5,17 +5,17 @@ entrypoint: gunicorn -b :$PORT main:app runtime_config: python_version: 3 -#[START env] +#[START gae_flex_mysql_env] env_variables: # Replace user, password, database, and instance connection name with the values obtained # when configuring your Cloud SQL instance. SQLALCHEMY_DATABASE_URI: >- mysql+pymysql://USER:PASSWORD@/DATABASE?unix_socket=/cloudsql/INSTANCE_CONNECTION_NAME -#[END env] +#[END gae_flex_mysql_env] -#[START cloudsql_settings] +#[START gae_flex_mysql_settings] # Replace project and instance with the values obtained when configuring your # Cloud SQL instance. beta_settings: cloud_sql_instances: INSTANCE_CONNECTION_NAME -#[END cloudsql_settings] +#[END gae_flex_mysql_settings] diff --git a/appengine/flexible/cloudsql/create_tables.py b/appengine/flexible/cloudsql/create_tables.py index 2a71c66b014..acb8c563f12 100755 --- a/appengine/flexible/cloudsql/create_tables.py +++ b/appengine/flexible/cloudsql/create_tables.py @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# [START all] - from main import db @@ -22,4 +20,3 @@ print('Creating all database tables...') db.create_all() print('Done!') -# [END all] diff --git a/appengine/flexible/cloudsql/main.py b/appengine/flexible/cloudsql/main.py index b64c3f08cde..832cb4f246a 100644 --- a/appengine/flexible/cloudsql/main.py +++ b/appengine/flexible/cloudsql/main.py @@ -34,7 +34,7 @@ def is_ipv6(addr): return False -# [START example] +# [START gae_flex_mysql_app] # Environment variables are defined in app.yaml. app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['SQLALCHEMY_DATABASE_URI'] app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False @@ -79,7 +79,7 @@ def index(): output = 'Last 10 visits:\n{}'.format('\n'.join(results)) return output, 200, {'Content-Type': 'text/plain; charset=utf-8'} -# [END example] +# [END gae_flex_mysql_app] @app.errorhandler(500) diff --git a/appengine/flexible/cloudsql_postgresql/app.yaml b/appengine/flexible/cloudsql_postgresql/app.yaml index e9ce4031e4e..dee7b123b98 100644 --- a/appengine/flexible/cloudsql_postgresql/app.yaml +++ b/appengine/flexible/cloudsql_postgresql/app.yaml @@ -5,17 +5,17 @@ entrypoint: gunicorn -b :$PORT main:app runtime_config: python_version: 3 -#[START env] +#[START gae_flex_postgres_env] env_variables: # Replace user, password, database, and instance connection name with the values obtained # when configuring your Cloud SQL instance. SQLALCHEMY_DATABASE_URI: >- postgresql+psycopg2://USER:PASSWORD@/DATABASE?host=/cloudsql/INSTANCE_CONNECTION_NAME -#[END env] +#[END gae_flex_postgres_env] -#[START cloudsql_settings] +#[START gae_flex_postgres_settings] # Replace project and instance with the values obtained when configuring your # Cloud SQL instance. beta_settings: cloud_sql_instances: INSTANCE_CONNECTION_NAME -#[END cloudsql_settings] +#[END gae_flex_postgres_settings] diff --git a/appengine/flexible/cloudsql_postgresql/create_tables.py b/appengine/flexible/cloudsql_postgresql/create_tables.py index 2a71c66b014..acb8c563f12 100755 --- a/appengine/flexible/cloudsql_postgresql/create_tables.py +++ b/appengine/flexible/cloudsql_postgresql/create_tables.py @@ -13,8 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# [START all] - from main import db @@ -22,4 +20,3 @@ print('Creating all database tables...') db.create_all() print('Done!') -# [END all] diff --git a/appengine/flexible/cloudsql_postgresql/main.py b/appengine/flexible/cloudsql_postgresql/main.py index 23ea8a4fd45..5ecc0622591 100644 --- a/appengine/flexible/cloudsql_postgresql/main.py +++ b/appengine/flexible/cloudsql_postgresql/main.py @@ -41,7 +41,7 @@ def is_ipv6(addr): return False -# [START example] +# [START gae_flex_postgres_app] # Environment variables are defined in app.yaml. app.config['SQLALCHEMY_DATABASE_URI'] = os.environ['SQLALCHEMY_DATABASE_URI'] app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False @@ -86,7 +86,7 @@ def index(): output = 'Last 10 visits:\n{}'.format('\n'.join(results)) return output, 200, {'Content-Type': 'text/plain; charset=utf-8'} -# [END example] +# [END gae_flex_postgres_app] @app.errorhandler(500) diff --git a/appengine/flexible/datastore/main.py b/appengine/flexible/datastore/main.py index 3130edd53ff..65e628b1a57 100644 --- a/appengine/flexible/datastore/main.py +++ b/appengine/flexible/datastore/main.py @@ -32,7 +32,7 @@ def is_ipv6(addr): return False -# [START example] +# [START gae_flex_datastore_app] @app.route('/') def index(): ds = datastore.Client() @@ -62,7 +62,7 @@ def index(): output = 'Last 10 visits:\n{}'.format('\n'.join(results)) return output, 200, {'Content-Type': 'text/plain; charset=utf-8'} -# [END example] +# [END gae_flex_datastore_app] @app.errorhandler(500) diff --git a/appengine/flexible/hello_world/main.py b/appengine/flexible/hello_world/main.py index 97eb37d83a2..967eb1a5097 100644 --- a/appengine/flexible/hello_world/main.py +++ b/appengine/flexible/hello_world/main.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# [START app] +# [START gae_flex_quickstart] import logging from flask import Flask @@ -40,4 +40,4 @@ def server_error(e): # This is used when running locally. Gunicorn is used to run the # application on Google App Engine. See entrypoint in app.yaml. app.run(host='127.0.0.1', port=8080, debug=True) -# [END app] +# [END gae_flex_quickstart] diff --git a/appengine/flexible/mailgun/main.py b/appengine/flexible/mailgun/main.py index d8872e742da..5491221d064 100644 --- a/appengine/flexible/mailgun/main.py +++ b/appengine/flexible/mailgun/main.py @@ -12,22 +12,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -# [START app] import logging import os from flask import Flask, render_template, request import requests -# [START config] MAILGUN_DOMAIN_NAME = os.environ['MAILGUN_DOMAIN_NAME'] MAILGUN_API_KEY = os.environ['MAILGUN_API_KEY'] -# [END config] app = Flask(__name__) -# [START simple_message] +# [START gae_flex_mailgun_simple_message] def send_simple_message(to): url = 'https://api.mailgun.net/v3/{}/messages'.format(MAILGUN_DOMAIN_NAME) auth = ('api', MAILGUN_API_KEY) @@ -40,10 +37,10 @@ def send_simple_message(to): response = requests.post(url, auth=auth, data=data) response.raise_for_status() -# [END simple_message] +# [END gae_flex_mailgun_simple_message] -# [START complex_message] +# [START gae_flex_mailgun_complex_message] def send_complex_message(to): url = 'https://api.mailgun.net/v3/{}/messages'.format(MAILGUN_DOMAIN_NAME) auth = ('api', MAILGUN_API_KEY) @@ -58,7 +55,7 @@ def send_complex_message(to): response = requests.post(url, auth=auth, data=data, files=files) response.raise_for_status() -# [END complex_message] +# [END gae_flex_mailgun_complex_message] @app.route('/') @@ -92,4 +89,3 @@ def server_error(e): # This is used when running locally. Gunicorn is used to run the # application on Google App Engine. See entrypoint in app.yaml. app.run(host='127.0.0.1', port=8080, debug=True) -# [END app] diff --git a/appengine/flexible/mailjet/app.yaml b/appengine/flexible/mailjet/app.yaml index 5c34e24d0ac..920e00c14d0 100644 --- a/appengine/flexible/mailjet/app.yaml +++ b/appengine/flexible/mailjet/app.yaml @@ -5,9 +5,9 @@ entrypoint: gunicorn -b :$PORT main:app runtime_config: python_version: 3 -# [START env_variables] -env_variables: +# [START gae_flex_mailjet_yaml] +gae_flex_mailjet_yaml: MAILJET_API_KEY: your-mailjet-api-key MAILJET_API_SECRET: your-mailjet-api-secret MAILJET_SENDER: your-mailjet-sender-address -# [END env_variables] +# [END gae_flex_mailjet_yaml] diff --git a/appengine/flexible/mailjet/main.py b/appengine/flexible/mailjet/main.py index 30c3a21f243..8383b1e44e6 100644 --- a/appengine/flexible/mailjet/main.py +++ b/appengine/flexible/mailjet/main.py @@ -12,23 +12,22 @@ # See the License for the specific language governing permissions and # limitations under the License. -# [START app] import logging import os from flask import Flask, render_template, request -# [START config] +# [START gae_flex_mailjet_config] import mailjet_rest MAILJET_API_KEY = os.environ['MAILJET_API_KEY'] MAILJET_API_SECRET = os.environ['MAILJET_API_SECRET'] MAILJET_SENDER = os.environ['MAILJET_SENDER'] -# [END config] +# [END gae_flex_mailjet_config] app = Flask(__name__) -# [START send_message] +# [START gae_flex_mailjet_send_message] def send_message(to): client = mailjet_rest.Client( auth=(MAILJET_API_KEY, MAILJET_API_SECRET), version='v3.1') @@ -51,7 +50,7 @@ def send_message(to): result = client.send.create(data=data) return result.json() -# [END send_message] +# [END gae_flex_mailjet_send_message] @app.route('/') @@ -81,4 +80,3 @@ def server_error(e): # This is used when running locally. Gunicorn is used to run the # application on Google App Engine. See entrypoint in app.yaml. app.run(host='127.0.0.1', port=8080, debug=True) -# [END app] diff --git a/appengine/flexible/memcache/app.yaml b/appengine/flexible/memcache/app.yaml index 1135714bca2..e13699063d3 100644 --- a/appengine/flexible/memcache/app.yaml +++ b/appengine/flexible/memcache/app.yaml @@ -5,7 +5,7 @@ entrypoint: gunicorn -b :$PORT main:app runtime_config: python_version: 3 -# [START env_variables] +# [START gae_flex_redislabs_memcache_yaml] env_variables: MEMCACHE_SERVER: your-memcache-server # If you are using a third-party or self-hosted Memcached server with SASL @@ -13,4 +13,4 @@ env_variables: # username and password. # MEMCACHE_USERNAME: your-memcache-username # MEMCACHE_PASSWORD: your-memcache-password -# [END env_variables] +# [END gae_flex_redislabs_memcache_yaml] diff --git a/appengine/flexible/memcache/main.py b/appengine/flexible/memcache/main.py index 5109aab19ec..3fa566a619a 100644 --- a/appengine/flexible/memcache/main.py +++ b/appengine/flexible/memcache/main.py @@ -21,7 +21,7 @@ app = Flask(__name__) -# [START client] +# [START gae_flex_redislabs_memcache] # Environment variables are defined in app.yaml. MEMCACHE_SERVER = os.environ.get('MEMCACHE_SERVER', 'localhost:11211') MEMCACHE_USERNAME = os.environ.get('MEMCACHE_USERNAME') @@ -30,10 +30,9 @@ memcache_client = pylibmc.Client( [MEMCACHE_SERVER], binary=True, username=MEMCACHE_USERNAME, password=MEMCACHE_PASSWORD) -# [END client] +# [END gae_flex_redislabs_memcache] -# [START example] @app.route('/') def index(): @@ -44,7 +43,6 @@ def index(): value = memcache_client.incr('counter', 1) return 'Value is {}'.format(value) -# [END example] @app.errorhandler(500) diff --git a/appengine/flexible/pubsub/app.yaml b/appengine/flexible/pubsub/app.yaml index 9cc0e98de57..e9cc58a8252 100644 --- a/appengine/flexible/pubsub/app.yaml +++ b/appengine/flexible/pubsub/app.yaml @@ -5,10 +5,10 @@ entrypoint: gunicorn -b :$PORT main:app runtime_config: python_version: 3 -#[START env] +# [START gae_flex_pubsub_env] env_variables: PUBSUB_TOPIC: your-topic # This token is used to verify that requests originate from your # application. It can be any sufficiently random string. PUBSUB_VERIFICATION_TOKEN: 1234abc -#[END env] +# [END gae_flex_pubsub_env] diff --git a/appengine/flexible/pubsub/main.py b/appengine/flexible/pubsub/main.py index 1bed8ef7a45..6821a2650bf 100644 --- a/appengine/flexible/pubsub/main.py +++ b/appengine/flexible/pubsub/main.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# [START app] import base64 import json import logging @@ -37,7 +36,7 @@ MESSAGES = [] -# [START index] +# [START gae_flex_pubsub_index] @app.route('/', methods=['GET', 'POST']) def index(): if request.method == 'GET': @@ -53,10 +52,10 @@ def index(): publisher.publish(topic_path, data=data) return 'OK', 200 -# [END index] +# [END gae_flex_pubsub_index] -# [START push] +# [START gae_flex_pubsub_push] @app.route('/pubsub/push', methods=['POST']) def pubsub_push(): if (request.args.get('token', '') != @@ -70,7 +69,7 @@ def pubsub_push(): # Returning any 2xx status indicates successful receipt of the message. return 'OK', 200 -# [END push] +# [END gae_flex_pubsub_push] @app.errorhandler(500) @@ -86,4 +85,3 @@ def server_error(e): # This is used when running locally. Gunicorn is used to run the # application on Google App Engine. See entrypoint in app.yaml. app.run(host='127.0.0.1', port=8080, debug=True) -# [END app] diff --git a/appengine/flexible/redis/app.yaml b/appengine/flexible/redis/app.yaml index b276da3b662..bbbbbb574d6 100644 --- a/appengine/flexible/redis/app.yaml +++ b/appengine/flexible/redis/app.yaml @@ -5,9 +5,9 @@ entrypoint: gunicorn -b :$PORT main:app runtime_config: python_version: 3 -# [START env_variables] -env_variables: +# [START gae_flex_python_redis_yaml] +gae_flex_python_redis_yaml: REDIS_HOST: your-redis-host REDIS_PORT: your-redis-port REDIS_PASSWORD: your-redis-password -# [END env_variables] +# [END gae_flex_python_redis_yaml] diff --git a/appengine/flexible/redis/main.py b/appengine/flexible/redis/main.py index 24caf09ae29..494eeaa10a0 100644 --- a/appengine/flexible/redis/main.py +++ b/appengine/flexible/redis/main.py @@ -22,21 +22,19 @@ app = Flask(__name__) -# [START client] +# [START gae_flex_python_redis] redis_host = os.environ.get('REDIS_HOST', 'localhost') redis_port = int(os.environ.get('REDIS_PORT', 6379)) redis_password = os.environ.get('REDIS_PASSWORD', None) redis_client = redis.StrictRedis( host=redis_host, port=redis_port, password=redis_password) -# [END client] +# [END gae_flex_python_redis] -# [START example] @app.route('/') def index(): value = redis_client.incr('counter', 1) return 'Value is {}'.format(value) -# [END example] @app.errorhandler(500) diff --git a/appengine/flexible/sendgrid/app.yaml b/appengine/flexible/sendgrid/app.yaml index 6161a615fef..467b30713dc 100644 --- a/appengine/flexible/sendgrid/app.yaml +++ b/appengine/flexible/sendgrid/app.yaml @@ -5,8 +5,8 @@ entrypoint: gunicorn -b :$PORT main:app runtime_config: python_version: 3 -# [START env_variables] -env_variables: +# [START gae_flex_sendgrid_yaml] +gae_flex_sendgrid_yaml: SENDGRID_API_KEY: your-sendgrid-api-key SENDGRID_SENDER: your-sendgrid-sender -# [END env_variables] +# [END gae_flex_sendgrid_yaml] diff --git a/appengine/flexible/sendgrid/main.py b/appengine/flexible/sendgrid/main.py index 0cfcb51fd0c..2b0617f798c 100644 --- a/appengine/flexible/sendgrid/main.py +++ b/appengine/flexible/sendgrid/main.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# [START app] import logging import os @@ -20,10 +19,8 @@ import sendgrid from sendgrid.helpers import mail -# [START config] SENDGRID_API_KEY = os.environ['SENDGRID_API_KEY'] SENDGRID_SENDER = os.environ['SENDGRID_SENDER'] -# [END config] app = Flask(__name__) @@ -33,7 +30,7 @@ def index(): return render_template('index.html') -# [START example] +# [START gae_flex_sendgrid] @app.route('/send/email', methods=['POST']) def send_email(): to = request.form.get('to') @@ -55,7 +52,7 @@ def send_email(): return 'An error occurred: {}'.format(response.body), 500 return 'Email sent.' -# [END example] +# [END gae_flex_sendgrid] @app.errorhandler(500) @@ -71,4 +68,3 @@ def server_error(e): # This is used when running locally. Gunicorn is used to run the # application on Google App Engine. See entrypoint in app.yaml. app.run(host='127.0.0.1', port=8080, debug=True) -# [END app] diff --git a/appengine/flexible/static_files/main.py b/appengine/flexible/static_files/main.py index ca218eb4975..667d59453d5 100644 --- a/appengine/flexible/static_files/main.py +++ b/appengine/flexible/static_files/main.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -# [START app] +# [START gae_flex_python_static_files] import logging from flask import Flask, render_template @@ -39,4 +39,4 @@ def server_error(e): # This is used when running locally. Gunicorn is used to run the # application on Google App Engine. See entrypoint in app.yaml. app.run(host='127.0.0.1', port=8080, debug=True) -# [END app] +# [END gae_flex_python_static_files] diff --git a/appengine/flexible/static_files/static/main.css b/appengine/flexible/static_files/static/main.css index fe0aca088c4..69c795697f0 100644 --- a/appengine/flexible/static_files/static/main.css +++ b/appengine/flexible/static_files/static/main.css @@ -13,9 +13,9 @@ 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. */ -/* [START example] */ +/* [START gae_flex_python_css] */ body { font-family: Verdana, Helvetica, sans-serif; background-color: #CCCCFF; } -/* [END example] */ +/* [END gae_flex_python_css] */ diff --git a/appengine/flexible/storage/app.yaml b/appengine/flexible/storage/app.yaml index 46ac46e9900..d42d550a8ac 100644 --- a/appengine/flexible/storage/app.yaml +++ b/appengine/flexible/storage/app.yaml @@ -5,7 +5,7 @@ entrypoint: gunicorn -b :$PORT main:app runtime_config: python_version: 3 -#[START env] +#[START gae_flex_storage_yaml] env_variables: CLOUD_STORAGE_BUCKET: your-bucket-name -#[END env] +#[END gae_flex_storage_yaml] diff --git a/appengine/flexible/storage/main.py b/appengine/flexible/storage/main.py index b5834362600..29f62c29642 100644 --- a/appengine/flexible/storage/main.py +++ b/appengine/flexible/storage/main.py @@ -12,23 +12,19 @@ # See the License for the specific language governing permissions and # limitations under the License. -# [START app] +# [START gae_flex_storage_app] import logging import os from flask import Flask, request from google.cloud import storage -# [start config] app = Flask(__name__) - # Configure this environment variable via app.yaml CLOUD_STORAGE_BUCKET = os.environ['CLOUD_STORAGE_BUCKET'] -# [end config] -# [START form] @app.route('/') def index(): return """ @@ -37,10 +33,8 @@ def index(): """ -# [END form] -# [START upload] @app.route('/upload', methods=['POST']) def upload(): """Process the uploaded file and upload it to Google Cloud Storage.""" @@ -65,7 +59,6 @@ def upload(): # The public URL can be used to directly access the uploaded file via HTTP. return blob.public_url -# [END upload] @app.errorhandler(500) @@ -81,4 +74,4 @@ def server_error(e): # This is used when running locally. Gunicorn is used to run the # application on Google App Engine. See entrypoint in app.yaml. app.run(host='127.0.0.1', port=8080, debug=True) -# [END app] +# [END gae_flex_storage_app] diff --git a/appengine/flexible/twilio/app.yaml b/appengine/flexible/twilio/app.yaml index bca1b610e00..597c1e6099d 100644 --- a/appengine/flexible/twilio/app.yaml +++ b/appengine/flexible/twilio/app.yaml @@ -5,9 +5,9 @@ entrypoint: gunicorn -b :$PORT main:app runtime_config: python_version: 3 -# [START env_variables] +# [START gae_flex_twilio_env] env_variables: TWILIO_ACCOUNT_SID: your-account-sid TWILIO_AUTH_TOKEN: your-auth-token TWILIO_NUMBER: your-twilio-number -# [END env_variables] +# [END gae_flex_twilio_env] diff --git a/appengine/flexible/twilio/main.py b/appengine/flexible/twilio/main.py index 4f1049fb558..f02689245f6 100644 --- a/appengine/flexible/twilio/main.py +++ b/appengine/flexible/twilio/main.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -# [START app] import logging import os @@ -21,27 +20,25 @@ from twilio.twiml import messaging_response, voice_response -# [START configuration] TWILIO_ACCOUNT_SID = os.environ['TWILIO_ACCOUNT_SID'] TWILIO_AUTH_TOKEN = os.environ['TWILIO_AUTH_TOKEN'] TWILIO_NUMBER = os.environ['TWILIO_NUMBER'] -# [END configuration] app = Flask(__name__) -# [START receive_call] +# [START gae_flex_twilio_receive_call] @app.route('/call/receive', methods=['POST']) def receive_call(): """Answers a call and replies with a simple greeting.""" response = voice_response.VoiceResponse() response.say('Hello from Twilio!') return str(response), 200, {'Content-Type': 'application/xml'} -# [END receive_call] +# [END gae_flex_twilio_receive_call] -# [START send_sms] +# [START gae_flex_twilio_send_sms] @app.route('/sms/send') def send_sms(): """Sends a simple SMS message.""" @@ -57,10 +54,10 @@ def send_sms(): body='Hello from Twilio!' ) return str(rv) -# [END send_sms] +# [END gae_flex_twilio_send_sms] -# [START receive_sms] +# [START gae_flex_twilio_receive_sms] @app.route('/sms/receive', methods=['POST']) def receive_sms(): """Receives an SMS message and replies with a simple greeting.""" @@ -72,7 +69,7 @@ def receive_sms(): response = messaging_response.MessagingResponse() response.message(message) return str(response), 200, {'Content-Type': 'application/xml'} -# [END receive_sms] +# [END gae_flex_twilio_receive_sms] @app.errorhandler(500) @@ -88,4 +85,3 @@ def server_error(e): # This is used when running locally. Gunicorn is used to run the # application on Google App Engine. See entrypoint in app.yaml. app.run(host='127.0.0.1', port=8080, debug=True) -# [END app] diff --git a/appengine/standard/analytics/app.yaml b/appengine/standard/analytics/app.yaml index 212e1aac4a8..ccce47480a9 100644 --- a/appengine/standard/analytics/app.yaml +++ b/appengine/standard/analytics/app.yaml @@ -6,7 +6,5 @@ handlers: - url: .* script: main.app -#[START env] env_variables: GA_TRACKING_ID: your-tracking-id -#[END env] diff --git a/appengine/standard/analytics/main.py b/appengine/standard/analytics/main.py index 81cf8b7e53e..9766605bb39 100644 --- a/appengine/standard/analytics/main.py +++ b/appengine/standard/analytics/main.py @@ -29,7 +29,7 @@ GA_TRACKING_ID = os.environ['GA_TRACKING_ID'] -# [START track_event] +# [START gae_analytics_track_event] def track_event(category, action, label=None, value=0): data = { 'v': '1', # API Version. @@ -59,7 +59,7 @@ def track_example(): category='Example', action='test action') return 'Event tracked.' -# [END track_event] +# [END gae_analytics_track_event] @app.errorhandler(500) diff --git a/appengine/standard/logging/writing_logs/main.py b/appengine/standard/logging/writing_logs/main.py index 442e7710020..1b5a5f425a5 100644 --- a/appengine/standard/logging/writing_logs/main.py +++ b/appengine/standard/logging/writing_logs/main.py @@ -18,7 +18,7 @@ the Google Cloud Console. """ -# [START all] +# [START gae_python_logging_request] import logging import webapp2 @@ -44,4 +44,4 @@ def get(self): ('/', MainPage) ], debug=True) -# [END all] +# [END gae_python_logging_request] diff --git a/appengine/standard/requests/main.py b/appengine/standard/requests/main.py index 5064b5b937e..fe3c1667248 100644 --- a/appengine/standard/requests/main.py +++ b/appengine/standard/requests/main.py @@ -23,7 +23,7 @@ import webapp2 -# [START request_timer] +# [START gae_python_request_timer] class TimerHandler(webapp2.RequestHandler): def get(self): from google.appengine.runtime import DeadlineExceededError @@ -36,27 +36,27 @@ def get(self): self.response.set_status(500) self.response.out.write( 'The request did not complete in time.') -# [END request_timer] +# [END gae_python_request_timer] -# [START environment] +# [START gae_python_environment] class PrintEnvironmentHandler(webapp2.RequestHandler): def get(self): self.response.headers['Content-Type'] = 'text/plain' for key, value in os.environ.iteritems(): self.response.out.write( "{} = {}\n".format(key, value)) -# [END environment] +# [END gae_python_environment] -# [START request_ids] +# [START gae_python_request_ids] class RequestIdHandler(webapp2.RequestHandler): def get(self): self.response.headers['Content-Type'] = 'text/plain' request_id = os.environ.get('REQUEST_LOG_ID') self.response.write( 'REQUEST_LOG_ID={}'.format(request_id)) -# [END request_ids] +# [END gae_python_request_ids] app = webapp2.WSGIApplication([