-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.0.2k-fips 26 Jan 2017'
- Loading branch information
1 parent
786916f
commit 9c3a109
Showing
2 changed files
with
12 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,20 @@ | ||
"""handler for SNS topic, to cloud function""" | ||
import json | ||
import os | ||
|
||
import requests | ||
from http.client import HTTPSConnection | ||
|
||
|
||
def lambda_handler(event, context): | ||
"""handle lambda""" | ||
function_url = os.getenv("FUNCTION_URL") | ||
domain, path = function_url.replace("https://", "").split("/", 1) | ||
print(event) | ||
res = requests.post(function_url, json=event) | ||
return {"statusCode": res.status_code} | ||
conn = HTTPSConnection(domain) | ||
conn.request( | ||
"POST", | ||
"/" + path, | ||
body=json.dumps(event), | ||
headers={"Content-Type": "application/json"}, | ||
) | ||
res = conn.getresponse() | ||
return {"statusCode": res.status} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters