@@ -61,7 +61,7 @@ def __init__(self, headers=None, retries=None, validate_certificate=True):
61
61
raise AppEnginePlatformError (
62
62
"URLFetch is not available in this environment." )
63
63
64
- if is_prod_appengine_v2 ():
64
+ if is_prod_appengine_mvms ():
65
65
raise AppEnginePlatformError (
66
66
"Use normal urllib3.PoolManager instead of AppEngineManager"
67
67
"on Managed VMs, as using URLFetch is not necessary in "
@@ -109,14 +109,14 @@ def urlopen(self, method, url, body=None, headers=None,
109
109
raise TimeoutError (self , e )
110
110
111
111
except urlfetch .InvalidURLError as e :
112
- if 'too large' in e . message :
112
+ if 'too large' in str ( e ) :
113
113
raise AppEnginePlatformError (
114
114
"URLFetch request too large, URLFetch only "
115
115
"supports requests up to 10mb in size." , e )
116
116
raise ProtocolError (e )
117
117
118
118
except urlfetch .DownloadError as e :
119
- if 'Too many redirects' in e . message :
119
+ if 'Too many redirects' in str ( e ) :
120
120
raise MaxRetryError (self , url , reason = e )
121
121
raise ProtocolError (e )
122
122
@@ -156,7 +156,7 @@ def urlopen(self, method, url, body=None, headers=None,
156
156
157
157
def _urlfetch_response_to_http_response (self , urlfetch_resp , ** response_kw ):
158
158
159
- if is_prod_appengine_v1 ():
159
+ if is_prod_appengine ():
160
160
# Production GAE handles deflate encoding automatically, but does
161
161
# not remove the encoding header.
162
162
content_encoding = urlfetch_resp .headers .get ('content-encoding' )
@@ -200,24 +200,24 @@ def _get_retries(self, retries, redirect):
200
200
201
201
def is_appengine ():
202
202
return (is_local_appengine () or
203
- is_prod_appengine_v1 () or
204
- is_prod_appengine_v2 ())
203
+ is_prod_appengine () or
204
+ is_prod_appengine_mvms ())
205
205
206
206
207
207
def is_appengine_sandbox ():
208
- return is_appengine () and not is_prod_appengine_v2 ()
208
+ return is_appengine () and not is_prod_appengine_mvms ()
209
209
210
210
211
211
def is_local_appengine ():
212
212
return ('APPENGINE_RUNTIME' in os .environ and
213
213
'Development/' in os .environ ['SERVER_SOFTWARE' ])
214
214
215
215
216
- def is_prod_appengine_v1 ():
216
+ def is_prod_appengine ():
217
217
return ('APPENGINE_RUNTIME' in os .environ and
218
218
'Google App Engine/' in os .environ ['SERVER_SOFTWARE' ] and
219
- not is_prod_appengine_v2 ())
219
+ not is_prod_appengine_mvms ())
220
220
221
221
222
- def is_prod_appengine_v2 ():
222
+ def is_prod_appengine_mvms ():
223
223
return os .environ .get ('GAE_VM' , False ) == 'true'
0 commit comments