Skip to content
This repository was archived by the owner on Dec 7, 2023. It is now read-only.

Commit b216734

Browse files
authored
Merge pull request #674 from chapmancl/master
updatd python cfnresponse code
2 parents 871addc + 879a4d3 commit b216734

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

doc_source/cfn-lambda-function-code-cfnresponsemodule.md

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -180,8 +180,9 @@ The following is the response module source code for Python 3 functions:
180180
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
181181
# See the License for the specific language governing permissions and limitations under the License.
182182
183-
from botocore.vendored import requests
183+
import urllib3
184184
import json
185+
http = urllib3.PoolManager()
185186
186187
SUCCESS = "SUCCESS"
187188
FAILED = "FAILED"
@@ -211,9 +212,7 @@ def send(event, context, responseStatus, responseData, physicalResourceId=None,
211212
}
212213
213214
try:
214-
response = requests.put(responseUrl,
215-
data=json_responseBody,
216-
headers=headers)
215+
response = http.request('PUT',responseUrl,body=json_responseBody.encode('utf-8'),headers=headers)
217216
print("Status code: " + response.reason)
218217
except Exception as e:
219218
print("send(..) failed executing requests.put(..): " + str(e))
@@ -229,8 +228,9 @@ The following is the response module source code for Python 2 functions:
229228
# This file is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, express or implied.
230229
# See the License for the specific language governing permissions and limitations under the License.
231230
232-
from botocore.vendored import requests
231+
import urllib3
233232
import json
233+
http = urllib3.PoolManager()
234234
235235
SUCCESS = "SUCCESS"
236236
FAILED = "FAILED"
@@ -260,9 +260,7 @@ def send(event, context, responseStatus, responseData, physicalResourceId=None,
260260
}
261261
262262
try:
263-
response = requests.put(responseUrl,
264-
data=json_responseBody,
265-
headers=headers)
263+
response = http.request('PUT',responseUrl,body=json_responseBody.encode('utf-8'),headers=headers)
266264
print "Status code: " + response.reason
267265
except Exception as e:
268266
print "send(..) failed executing requests.put(..): " + str(e)

0 commit comments

Comments
 (0)