Skip to content

Commit cc88e66

Browse files
authored
Update Region Tags (#1650)
* app_identity, blobstore region tags * fix errors * logs * region tags * standard region tags * fix region tag typo
1 parent de2cb86 commit cc88e66

File tree

21 files changed

+47
-83
lines changed

21 files changed

+47
-83
lines changed

appengine/flexible/mailjet/app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ runtime_config:
66
python_version: 3
77

88
# [START gae_flex_mailjet_yaml]
9-
gae_flex_mailjet_yaml:
9+
env_variables:
1010
MAILJET_API_KEY: your-mailjet-api-key
1111
MAILJET_API_SECRET: your-mailjet-api-secret
1212
MAILJET_SENDER: your-mailjet-sender-address

appengine/flexible/metadata/main.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# [START app]
1615
import logging
1716

1817
from flask import Flask
@@ -23,7 +22,7 @@
2322
app = Flask(__name__)
2423

2524

26-
# [START metadata]
25+
# [START gae_flex_metadata]
2726
METADATA_NETWORK_INTERFACE_URL = \
2827
('http://metadata/computeMetadata/v1/instance/network-interfaces/0/'
2928
'access-configs/0/external-ip')
@@ -43,7 +42,7 @@ def get_external_ip():
4342
except requests.RequestException:
4443
logging.info('Metadata server could not be reached, assuming local.')
4544
return 'localhost'
46-
# [END metadata]
45+
# [END gae_flex_metadata]
4746

4847

4948
@app.route('/')
@@ -52,7 +51,6 @@ def index():
5251
# external IP address of this instance is needed.
5352
external_ip = get_external_ip()
5453
return 'External IP: {}'.format(external_ip)
55-
# [END app]
5654

5755

5856
@app.errorhandler(500)

appengine/flexible/numpy/main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
app = Flask(__name__)
2121

2222

23-
# [START numpy]
2423
@app.route('/')
2524
def calculate():
2625
return_str = ''
@@ -32,7 +31,6 @@ def calculate():
3231
# Multiply matrices
3332
return_str += 'x dot y : {}'.format(str(np.dot(x, y)))
3433
return return_str
35-
# [END numpy]
3634

3735

3836
@app.errorhandler(500)

appengine/flexible/pubsub/templates/index.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,9 @@
2828
</ul>
2929
<p><small>Note: because your application is likely running multiple instances, each instance will have a different list of messages.</small></p>
3030
</div>
31-
<!-- [START form] -->
3231
<form method="post">
3332
<textarea name="payload" placeholder="Enter message here"></textarea>
3433
<input type="submit">
3534
</form>
36-
<!-- [END form] -->
3735
</body>
3836
</html>

appengine/flexible/redis/app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ runtime_config:
66
python_version: 3
77

88
# [START gae_flex_python_redis_yaml]
9-
gae_flex_python_redis_yaml:
9+
env_variables:
1010
REDIS_HOST: your-redis-host
1111
REDIS_PORT: your-redis-port
1212
REDIS_PASSWORD: your-redis-password

appengine/flexible/scipy/main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
app = Flask(__name__)
2222

2323

24-
# [START scipy]
2524
@app.route('/')
2625
def resize():
2726
"""Demonstrates using scipy to resize an image."""
@@ -34,7 +33,6 @@ def resize():
3433
# Write the tinted image back to disk
3534
scipy.misc.imsave(output_image_path, img_tinted)
3635
return "Image resized."
37-
# [END scipy]
3836

3937

4038
@app.errorhandler(500)

appengine/flexible/sendgrid/app.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ runtime_config:
66
python_version: 3
77

88
# [START gae_flex_sendgrid_yaml]
9-
gae_flex_sendgrid_yaml:
9+
env_variables:
1010
SENDGRID_API_KEY: your-sendgrid-api-key
1111
SENDGRID_SENDER: your-sendgrid-sender
1212
# [END gae_flex_sendgrid_yaml]

appengine/standard/app_identity/asserting/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
For more information about App Engine, see README.md under /appengine.
2020
"""
2121

22-
# [START all]
22+
# [START gae_python_app_identity_asserting]
2323
import json
2424
import logging
2525

@@ -59,4 +59,4 @@ def get(self):
5959
('/', MainPage)
6060
], debug=True)
6161

62-
# [END all]
62+
# [END gae_python_app_identity_asserting]

appengine/standard/app_identity/incoming/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
For more information about App Engine, see README.md under /appengine.
2020
"""
2121

22-
# [START all]
22+
# [START gae_python_app_identity_incoming]
2323
import webapp2
2424

2525

@@ -43,4 +43,4 @@ def get(self):
4343
('/', MainPage)
4444
], debug=True)
4545

46-
# [END all]
46+
# [END gae_python_app_identity_incoming]

appengine/standard/app_identity/signing/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
For more information about App Engine, see README.md under /appengine.
2020
"""
2121

22-
# [START all]
22+
# [START gae_python_app_identity_signing]
2323

2424
import base64
2525

@@ -81,4 +81,4 @@ def get(self):
8181
('/', MainPage)
8282
], debug=True)
8383

84-
# [END all]
84+
# [END gae_python_app_identity_signing]

appengine/standard/appstats/main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
For more information about App Engine, see README.md under /appengine.
1919
"""
2020

21-
# [START all]
2221
from google.appengine.api import memcache
2322
import webapp2
2423

@@ -34,4 +33,3 @@ def get(self):
3433
app = webapp2.WSGIApplication([
3534
('/', MainPage)
3635
], debug=True)
37-
# [END all]

appengine/standard/background/main.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
app.yaml scaling must be set to manual or basic.
2020
"""
2121

22-
# [START background-imp]
22+
# [START gae_runtime_import]
2323
from google.appengine.api import background_thread
24-
# [END background-imp]
24+
# [END gae_runtime_import]
2525

2626
import webapp2
2727

@@ -58,7 +58,7 @@ def get(self):
5858
"""
5959
auto = self.request.get('auto')
6060

61-
# [START background-start]
61+
# [START gae_runtime]
6262
# sample function to run in a background thread
6363
def change_val(arg):
6464
global val
@@ -72,7 +72,7 @@ def change_val(arg):
7272
t = background_thread.BackgroundThread(
7373
target=change_val, args=['Cat'])
7474
t.start()
75-
# [END background-start]
75+
# [END gae_runtime]
7676

7777
self.response.headers['Content-Type'] = 'text/plain'
7878
self.response.write('Done')
@@ -83,4 +83,3 @@ def change_val(arg):
8383
('/dog', SetDogHandler),
8484
('/cat', SetCatBackgroundHandler),
8585
], debug=True)
86-
# [END all]

appengine/standard/bigquery/main.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15-
# [START all]
1615

1716
"""
1817
Sample App Engine application that demonstrates authentication to BigQuery
@@ -65,4 +64,3 @@ def get(self):
6564
# Create the endpoint to receive oauth flow callbacks
6665
(decorator.callback_path, decorator.callback_handler())
6766
], debug=True)
68-
# [END all]

appengine/standard/blobstore/api/main.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
For more information, see README.md.
1919
"""
2020

21-
# [START all]
21+
# [START gae_blobstore_sample]
2222
from google.appengine.api import users
2323
from google.appengine.ext import blobstore
2424
from google.appengine.ext import ndb
@@ -34,10 +34,10 @@ class UserPhoto(ndb.Model):
3434

3535
class PhotoUploadFormHandler(webapp2.RequestHandler):
3636
def get(self):
37-
# [START upload_url]
37+
# [START gae_blobstore_upload_url]
3838
upload_url = blobstore.create_upload_url('/upload_photo')
39-
# [END upload_url]
40-
# [START upload_form]
39+
# [END gae_blobstore_upload_url]
40+
# [START gae_blobstore_upload_form]
4141
# To upload files to the blobstore, the request method must be "POST"
4242
# and enctype must be set to "multipart/form-data".
4343
self.response.out.write("""
@@ -47,10 +47,10 @@ def get(self):
4747
<input type="submit" name="submit" value="Submit">
4848
</form>
4949
</body></html>""".format(upload_url))
50-
# [END upload_form]
50+
# [END gae_blobstore_upload_form]
5151

5252

53-
# [START upload_handler]
53+
# [START gae_blobstore_upload_handler]
5454
class PhotoUploadHandler(blobstore_handlers.BlobstoreUploadHandler):
5555
def post(self):
5656
upload = self.get_uploads()[0]
@@ -60,22 +60,22 @@ def post(self):
6060
user_photo.put()
6161

6262
self.redirect('/view_photo/%s' % upload.key())
63-
# [END upload_handler]
63+
# [END gae_blobstore_upload_handler]
6464

6565

66-
# [START download_handler]
66+
# [START gae_blobstore_download_handler]
6767
class ViewPhotoHandler(blobstore_handlers.BlobstoreDownloadHandler):
6868
def get(self, photo_key):
6969
if not blobstore.get(photo_key):
7070
self.error(404)
7171
else:
7272
self.send_blob(photo_key)
73-
# [END download_handler]
73+
# [END gae_blobstore_download_handler]
7474

7575

7676
app = webapp2.WSGIApplication([
7777
('/', PhotoUploadFormHandler),
7878
('/upload_photo', PhotoUploadHandler),
7979
('/view_photo/([^/]+)?', ViewPhotoHandler),
8080
], debug=True)
81-
# [END all]
81+
# [END gae_blobstore_sample]

appengine/standard/blobstore/blobreader/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def get(self):
2626
blobstore_filename = '/gs{}'.format(filename)
2727
blob_key = blobstore.create_gs_key(blobstore_filename)
2828

29-
# [START blob_reader]
29+
# [START gae_blobstore_reader]
3030
# Instantiate a BlobReader for a given Blobstore blob_key.
3131
blob_reader = blobstore.BlobReader(blob_key)
3232

@@ -58,7 +58,7 @@ def get(self):
5858
blob_reader.seek(0)
5959
for line in blob_reader:
6060
self.response.write(line)
61-
# [END blob_reader]
61+
# [END gae_blobstore_reader]
6262

6363
# Delete the file from Google Cloud Storage using the blob_key.
6464
blobstore.delete(blob_key)

appengine/standard/channel/chatactoe.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
For more information, see the README.md.
2020
"""
2121

22-
# [START all]
2322
import json
2423
import os
2524
import re
@@ -54,7 +53,6 @@ class Wins():
5453
o_wins = map(lambda s: re.compile(s), o_win_patterns)
5554

5655

57-
# [START validate_message_3]
5856
class GameUpdater():
5957
"""Creates an object to store the game's state, and handles validating moves
6058
and broadcasting updates to the game."""
@@ -111,10 +109,8 @@ def make_move(self, position, user):
111109
self.game.put()
112110
self.send_update()
113111
return
114-
# [END validate_message_3]
115112

116113

117-
# [START validate_message_2]
118114
class GameFromRequest():
119115
game = None
120116

@@ -126,18 +122,15 @@ def __init__(self, request):
126122

127123
def get_game(self):
128124
return self.game
129-
# [END validate_message_2]
130125

131126

132-
# [START validate_message_1]
133127
class MovePage(webapp2.RequestHandler):
134128
def post(self):
135129
game = GameFromRequest(self.request).get_game()
136130
user = users.get_current_user()
137131
if game and user:
138132
id = int(self.request.get('i'))
139133
GameUpdater(game).make_move(id, user)
140-
# [END validate_message_1]
141134

142135

143136
class OpenedPage(webapp2.RequestHandler):
@@ -146,7 +139,6 @@ def post(self):
146139
GameUpdater(game).send_update()
147140

148141

149-
# [START create_channel_1]
150142
class MainPage(webapp2.RequestHandler):
151143
"""The main UI page, renders the 'index.html' template."""
152144

@@ -189,7 +181,6 @@ def get(self):
189181
self.response.out.write('No such game')
190182
else:
191183
self.redirect(users.create_login_url(self.request.uri))
192-
# [END create_channel_1]
193184

194185

195186
jinja_environment = jinja2.Environment(
@@ -200,5 +191,3 @@ def get(self):
200191
('/opened', OpenedPage),
201192
('/move', MovePage)
202193
], debug=True)
203-
204-
# [END all]

appengine/standard/cloudsql/app.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ libraries:
1010
- name: MySQLdb
1111
version: "latest"
1212

13-
# [START env_variables]
13+
# [START gae_python_mysql_env]
1414
env_variables:
1515
CLOUDSQL_CONNECTION_NAME: your-connection-name
1616
CLOUDSQL_USER: root
1717
CLOUDSQL_PASSWORD: your-cloudsql-user-password
18-
# [END env_variables]
18+
# [END gae_python_mysql_env]

appengine/standard/cloudsql/main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
For more information, see the README.md.
2020
"""
2121

22-
# [START all]
22+
# [START gae_python_mysql_app]
2323
import os
2424

2525
import MySQLdb
@@ -76,4 +76,4 @@ def get(self):
7676
('/', MainPage),
7777
], debug=True)
7878

79-
# [END all]
79+
# [END gae_python_mysql_app]

0 commit comments

Comments
 (0)