Skip to content

Update Region Tags #1650

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Aug 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion appengine/flexible/mailjet/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ runtime_config:
python_version: 3

# [START gae_flex_mailjet_yaml]
gae_flex_mailjet_yaml:
env_variables:
MAILJET_API_KEY: your-mailjet-api-key
MAILJET_API_SECRET: your-mailjet-api-secret
MAILJET_SENDER: your-mailjet-sender-address
Expand Down
6 changes: 2 additions & 4 deletions appengine/flexible/metadata/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START app]
import logging

from flask import Flask
Expand All @@ -23,7 +22,7 @@
app = Flask(__name__)


# [START metadata]
# [START gae_flex_metadata]
METADATA_NETWORK_INTERFACE_URL = \
('http://metadata/computeMetadata/v1/instance/network-interfaces/0/'
'access-configs/0/external-ip')
Expand All @@ -43,7 +42,7 @@ def get_external_ip():
except requests.RequestException:
logging.info('Metadata server could not be reached, assuming local.')
return 'localhost'
# [END metadata]
# [END gae_flex_metadata]


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


@app.errorhandler(500)
Expand Down
2 changes: 0 additions & 2 deletions appengine/flexible/numpy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
app = Flask(__name__)


# [START numpy]
@app.route('/')
def calculate():
return_str = ''
Expand All @@ -32,7 +31,6 @@ def calculate():
# Multiply matrices
return_str += 'x dot y : {}'.format(str(np.dot(x, y)))
return return_str
# [END numpy]


@app.errorhandler(500)
Expand Down
2 changes: 0 additions & 2 deletions appengine/flexible/pubsub/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,9 @@
</ul>
<p><small>Note: because your application is likely running multiple instances, each instance will have a different list of messages.</small></p>
</div>
<!-- [START form] -->
<form method="post">
<textarea name="payload" placeholder="Enter message here"></textarea>
<input type="submit">
</form>
<!-- [END form] -->
</body>
</html>
2 changes: 1 addition & 1 deletion appengine/flexible/redis/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ runtime_config:
python_version: 3

# [START gae_flex_python_redis_yaml]
gae_flex_python_redis_yaml:
env_variables:
REDIS_HOST: your-redis-host
REDIS_PORT: your-redis-port
REDIS_PASSWORD: your-redis-password
Expand Down
2 changes: 0 additions & 2 deletions appengine/flexible/scipy/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
app = Flask(__name__)


# [START scipy]
@app.route('/')
def resize():
"""Demonstrates using scipy to resize an image."""
Expand All @@ -34,7 +33,6 @@ def resize():
# Write the tinted image back to disk
scipy.misc.imsave(output_image_path, img_tinted)
return "Image resized."
# [END scipy]


@app.errorhandler(500)
Expand Down
2 changes: 1 addition & 1 deletion appengine/flexible/sendgrid/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ runtime_config:
python_version: 3

# [START gae_flex_sendgrid_yaml]
gae_flex_sendgrid_yaml:
env_variables:
SENDGRID_API_KEY: your-sendgrid-api-key
SENDGRID_SENDER: your-sendgrid-sender
# [END gae_flex_sendgrid_yaml]
4 changes: 2 additions & 2 deletions appengine/standard/app_identity/asserting/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
For more information about App Engine, see README.md under /appengine.
"""

# [START all]
# [START gae_python_app_identity_asserting]
import json
import logging

Expand Down Expand Up @@ -59,4 +59,4 @@ def get(self):
('/', MainPage)
], debug=True)

# [END all]
# [END gae_python_app_identity_asserting]
4 changes: 2 additions & 2 deletions appengine/standard/app_identity/incoming/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
For more information about App Engine, see README.md under /appengine.
"""

# [START all]
# [START gae_python_app_identity_incoming]
import webapp2


Expand All @@ -43,4 +43,4 @@ def get(self):
('/', MainPage)
], debug=True)

# [END all]
# [END gae_python_app_identity_incoming]
4 changes: 2 additions & 2 deletions appengine/standard/app_identity/signing/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
For more information about App Engine, see README.md under /appengine.
"""

# [START all]
# [START gae_python_app_identity_signing]

import base64

Expand Down Expand Up @@ -81,4 +81,4 @@ def get(self):
('/', MainPage)
], debug=True)

# [END all]
# [END gae_python_app_identity_signing]
2 changes: 0 additions & 2 deletions appengine/standard/appstats/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
For more information about App Engine, see README.md under /appengine.
"""

# [START all]
from google.appengine.api import memcache
import webapp2

Expand All @@ -34,4 +33,3 @@ def get(self):
app = webapp2.WSGIApplication([
('/', MainPage)
], debug=True)
# [END all]
9 changes: 4 additions & 5 deletions appengine/standard/background/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
app.yaml scaling must be set to manual or basic.
"""

# [START background-imp]
# [START gae_runtime_import]
from google.appengine.api import background_thread
# [END background-imp]
# [END gae_runtime_import]

import webapp2

Expand Down Expand Up @@ -58,7 +58,7 @@ def get(self):
"""
auto = self.request.get('auto')

# [START background-start]
# [START gae_runtime]
# sample function to run in a background thread
def change_val(arg):
global val
Expand All @@ -72,7 +72,7 @@ def change_val(arg):
t = background_thread.BackgroundThread(
target=change_val, args=['Cat'])
t.start()
# [END background-start]
# [END gae_runtime]

self.response.headers['Content-Type'] = 'text/plain'
self.response.write('Done')
Expand All @@ -83,4 +83,3 @@ def change_val(arg):
('/dog', SetDogHandler),
('/cat', SetCatBackgroundHandler),
], debug=True)
# [END all]
2 changes: 0 additions & 2 deletions appengine/standard/bigquery/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START all]

"""
Sample App Engine application that demonstrates authentication to BigQuery
Expand Down Expand Up @@ -65,4 +64,3 @@ def get(self):
# Create the endpoint to receive oauth flow callbacks
(decorator.callback_path, decorator.callback_handler())
], debug=True)
# [END all]
20 changes: 10 additions & 10 deletions appengine/standard/blobstore/api/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
For more information, see README.md.
"""

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

class PhotoUploadFormHandler(webapp2.RequestHandler):
def get(self):
# [START upload_url]
# [START gae_blobstore_upload_url]
upload_url = blobstore.create_upload_url('/upload_photo')
# [END upload_url]
# [START upload_form]
# [END gae_blobstore_upload_url]
# [START gae_blobstore_upload_form]
# To upload files to the blobstore, the request method must be "POST"
# and enctype must be set to "multipart/form-data".
self.response.out.write("""
Expand All @@ -47,10 +47,10 @@ def get(self):
<input type="submit" name="submit" value="Submit">
</form>
</body></html>""".format(upload_url))
# [END upload_form]
# [END gae_blobstore_upload_form]


# [START upload_handler]
# [START gae_blobstore_upload_handler]
class PhotoUploadHandler(blobstore_handlers.BlobstoreUploadHandler):
def post(self):
upload = self.get_uploads()[0]
Expand All @@ -60,22 +60,22 @@ def post(self):
user_photo.put()

self.redirect('/view_photo/%s' % upload.key())
# [END upload_handler]
# [END gae_blobstore_upload_handler]


# [START download_handler]
# [START gae_blobstore_download_handler]
class ViewPhotoHandler(blobstore_handlers.BlobstoreDownloadHandler):
def get(self, photo_key):
if not blobstore.get(photo_key):
self.error(404)
else:
self.send_blob(photo_key)
# [END download_handler]
# [END gae_blobstore_download_handler]


app = webapp2.WSGIApplication([
('/', PhotoUploadFormHandler),
('/upload_photo', PhotoUploadHandler),
('/view_photo/([^/]+)?', ViewPhotoHandler),
], debug=True)
# [END all]
# [END gae_blobstore_sample]
4 changes: 2 additions & 2 deletions appengine/standard/blobstore/blobreader/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def get(self):
blobstore_filename = '/gs{}'.format(filename)
blob_key = blobstore.create_gs_key(blobstore_filename)

# [START blob_reader]
# [START gae_blobstore_reader]
# Instantiate a BlobReader for a given Blobstore blob_key.
blob_reader = blobstore.BlobReader(blob_key)

Expand Down Expand Up @@ -58,7 +58,7 @@ def get(self):
blob_reader.seek(0)
for line in blob_reader:
self.response.write(line)
# [END blob_reader]
# [END gae_blobstore_reader]

# Delete the file from Google Cloud Storage using the blob_key.
blobstore.delete(blob_key)
Expand Down
11 changes: 0 additions & 11 deletions appengine/standard/channel/chatactoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
For more information, see the README.md.
"""

# [START all]
import json
import os
import re
Expand Down Expand Up @@ -54,7 +53,6 @@ class Wins():
o_wins = map(lambda s: re.compile(s), o_win_patterns)


# [START validate_message_3]
class GameUpdater():
"""Creates an object to store the game's state, and handles validating moves
and broadcasting updates to the game."""
Expand Down Expand Up @@ -111,10 +109,8 @@ def make_move(self, position, user):
self.game.put()
self.send_update()
return
# [END validate_message_3]


# [START validate_message_2]
class GameFromRequest():
game = None

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

def get_game(self):
return self.game
# [END validate_message_2]


# [START validate_message_1]
class MovePage(webapp2.RequestHandler):
def post(self):
game = GameFromRequest(self.request).get_game()
user = users.get_current_user()
if game and user:
id = int(self.request.get('i'))
GameUpdater(game).make_move(id, user)
# [END validate_message_1]


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


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

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


jinja_environment = jinja2.Environment(
Expand All @@ -200,5 +191,3 @@ def get(self):
('/opened', OpenedPage),
('/move', MovePage)
], debug=True)

# [END all]
4 changes: 2 additions & 2 deletions appengine/standard/cloudsql/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ libraries:
- name: MySQLdb
version: "latest"

# [START env_variables]
# [START gae_python_mysql_env]
env_variables:
CLOUDSQL_CONNECTION_NAME: your-connection-name
CLOUDSQL_USER: root
CLOUDSQL_PASSWORD: your-cloudsql-user-password
# [END env_variables]
# [END gae_python_mysql_env]
4 changes: 2 additions & 2 deletions appengine/standard/cloudsql/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
For more information, see the README.md.
"""

# [START all]
# [START gae_python_mysql_app]
import os

import MySQLdb
Expand Down Expand Up @@ -76,4 +76,4 @@ def get(self):
('/', MainPage),
], debug=True)

# [END all]
# [END gae_python_mysql_app]
Loading