in source/update_ddb_from_stream/update_ddb_from_stream.py [0:0]
def sendAnonymousData(event_time,dataDict):
log.debug("Sending Anonymous Data")
postDict = {}
postDict['Data'] = dataDict
postDict['TimeStamp'] = event_time
postDict['Solution'] = 'SO0037'
postDict['UUID'] = os.environ.get('UUID')
# API Gateway URL to make HTTP POST call
url = 'https://metrics.awssolutionsbuilder.com/generic'
data = urllib.parse.urlencode(postDict).encode()
log.debug(data)
headers = {'content-type': 'application/json'}
req = urllib.request.Request(url, data, headers)
rsp = urllib.request.urlopen(req)
rspcode = rsp.getcode()
content = rsp.read()
log.debug("Response from APIGateway: %s, %s", rspcode, content)