Skip to content

Commit d0205c0

Browse files
chore(gae): rename region tags from standard/urlfetch async and snippets folders (#13091)
* chore(gae): add requirements.txt and requirements-test.txt * chore(gae): rename region tags from standard/urlfetch/async/rpc.py * chore(gae): add requirements.txt and requirements-test.txt * chore(gae): rename region tags from standard/urlfetch/snippets/main.py
1 parent 4f6ffd1 commit d0205c0

File tree

6 files changed

+38
-26
lines changed

6 files changed

+38
-26
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# pin pytest to 4.6.11 for Python2.
2+
pytest==4.6.11; python_version < '3.0'
3+
4+
# pytest==8.3.4 and six==1.17.0 for Python3.
5+
pytest==8.3.4; python_version >= '3.0'
6+
six==1.17.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

appengine/standard/urlfetch/async/rpc.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@
1515
import functools
1616
import logging
1717

18-
# [START urlfetch-import]
18+
# [START gae_urlfetch_async_import]
1919
from google.appengine.api import urlfetch
20+
# [END gae_urlfetch_async_import]
2021

21-
# [END urlfetch-import]
2222
import webapp2
2323

2424

2525
class UrlFetchRpcHandler(webapp2.RequestHandler):
26-
"""Demonstrates an asynchronous HTTP query using urlfetch"""
26+
"""Demonstrates an asynchronous HTTP query using urlfetch."""
2727

2828
def get(self):
29-
# [START urlfetch-rpc]
29+
# [START gae_urlfetch_async_rpc]
3030
rpc = urlfetch.create_rpc()
3131
urlfetch.make_fetch_call(rpc, "http://www.google.com/")
3232

@@ -44,15 +44,15 @@ def get(self):
4444
except urlfetch.DownloadError:
4545
self.response.status_int = 500
4646
self.response.write("Error fetching URL")
47-
# [END urlfetch-rpc]
47+
# [END gae_urlfetch_async_rpc]
4848

4949

5050
class UrlFetchRpcCallbackHandler(webapp2.RequestHandler):
5151
"""Demonstrates an asynchronous HTTP query with a callback using
52-
urlfetch"""
52+
urlfetch."""
5353

5454
def get(self):
55-
# [START urlfetch-rpc-callback]
55+
# [START gae_urlfetch_async_rpc_callback]
5656
def handle_result(rpc):
5757
result = rpc.get_result()
5858
self.response.write(result.content)
@@ -78,7 +78,7 @@ def handle_result(rpc):
7878
rpc.wait()
7979

8080
logging.info("Done waiting for RPCs")
81-
# [END urlfetch-rpc-callback]
81+
# [END gae_urlfetch_async_rpc_callback]
8282

8383

8484
app = webapp2.WSGIApplication(

appengine/standard/urlfetch/snippets/main.py

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

15-
"""
16-
Sample application that demonstrates different ways of fetching
17-
URLS on App Engine
15+
"""Sample application that demonstrates different ways of fetching
16+
URLS on App Engine.
1817
"""
1918

2019
import logging
2120
import urllib
2221

23-
# [START urllib2-imports]
22+
# [START gae_urlfetch_snippets_imports_urllib2]
2423
import urllib2
24+
# [END gae_urlfetch_snippets_imports_urllib2]
2525

26-
# [END urllib2-imports]
27-
28-
# [START urlfetch-imports]
26+
# [START gae_urlfetch_snippets_imports_urlfetch]
2927
from google.appengine.api import urlfetch
28+
# [END gae_urlfetch_snippets_imports_urlfetch]
3029

31-
# [END urlfetch-imports]
3230
import webapp2
3331

3432

3533
class UrlLibFetchHandler(webapp2.RequestHandler):
36-
"""Demonstrates an HTTP query using urllib2"""
34+
"""Demonstrates an HTTP query using urllib2."""
3735

3836
def get(self):
39-
# [START urllib-get]
37+
# [START gae_urlfetch_snippets_urllib2_get]
4038
url = "http://www.google.com/humans.txt"
4139
try:
4240
result = urllib2.urlopen(url)
4341
self.response.write(result.read())
4442
except urllib2.URLError:
4543
logging.exception("Caught exception fetching url")
46-
# [END urllib-get]
44+
# [END gae_urlfetch_snippets_urllib2_get]
4745

4846

4947
class UrlFetchHandler(webapp2.RequestHandler):
50-
"""Demonstrates an HTTP query using urlfetch"""
48+
"""Demonstrates an HTTP query using urlfetch."""
5149

5250
def get(self):
53-
# [START urlfetch-get]
51+
# [START gae_urlfetch_snippets_urlfetch_get]
5452
url = "http://www.google.com/humans.txt"
5553
try:
5654
result = urlfetch.fetch(url)
@@ -60,19 +58,19 @@ def get(self):
6058
self.response.status_code = result.status_code
6159
except urlfetch.Error:
6260
logging.exception("Caught exception fetching url")
63-
# [END urlfetch-get]
61+
# [END gae_urlfetch_snippets_urlfetch_get]
6462

6563

6664
class UrlPostHandler(webapp2.RequestHandler):
67-
"""Demonstrates an HTTP POST form query using urlfetch"""
65+
"""Demonstrates an HTTP POST form query using urlfetch."""
6866

6967
form_fields = {
7068
"first_name": "Albert",
7169
"last_name": "Johnson",
7270
}
7371

7472
def get(self):
75-
# [START urlfetch-post]
73+
# [START gae_urlfetch_snippets_urlfetch_post]
7674
try:
7775
form_data = urllib.urlencode(UrlPostHandler.form_fields)
7876
headers = {"Content-Type": "application/x-www-form-urlencoded"}
@@ -85,11 +83,11 @@ def get(self):
8583
self.response.write(result.content)
8684
except urlfetch.Error:
8785
logging.exception("Caught exception fetching url")
88-
# [END urlfetch-post]
86+
# [END gae_urlfetch_snippets_urlfetch_post]
8987

9088

9189
class SubmitHandler(webapp2.RequestHandler):
92-
"""Handler that receives UrlPostHandler POST request"""
90+
"""Handler that receives UrlPostHandler POST request."""
9391

9492
def post(self):
9593
self.response.out.write((self.request.get("first_name")))
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# pin pytest to 4.6.11 for Python2.
2+
pytest==4.6.11; python_version < '3.0'
3+
4+
# pytest==8.3.4 and six==1.17.0 for Python3.
5+
pytest==8.3.4; python_version >= '3.0'
6+
six==1.17.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

0 commit comments

Comments
 (0)