from . import * import base64 import gzip from io import BytesIO message = "[{\"software_name\": \"radiosonde_auto_rx\", \"software_version\": \"1.5.4\", \"uploader_callsign\": \"BARN5\", \"uploader_position\": \"48.950958,6.135996\", \"uploader_antenna\": \"1/4 wave monopole\", \"time_received\": \"2021-12-20T05:23:08.275935Z\", \"datetime\": \"2021-12-20T05:23:24.001000Z\", \"manufacturer\": \"Vaisala\", \"type\": \"RS41\", \"serial\": \"T1310890\", \"subtype\": \"RS41-SGP\", \"frame\": 2795, \"lat\": 49.36924, \"lon\": 7.49886, \"alt\": 13526.89728, \"temp\": -67.1, \"humidity\": 16.1, \"pressure\": 149.8, \"vel_v\": 2.84469, \"vel_h\": 22.2337, \"heading\": 134.28404, \"sats\": 9, \"batt\": 2.8, \"frequency\": 402.7, \"burst_timer\": 15902, \"snr\": 10.3, \"user-agent\": \"Amazon CloudFront\", \"position\": \"49.36924,7.49886\", \"upload_time_delta\": -1.463, \"uploader_alt\": 185.0}, {\"software_name\": \"radiosonde_auto_rx\", \"software_version\": \"1.5.4\", \"uploader_callsign\": \"BARN5\", \"uploader_position\": \"48.950958,6.135996\", \"uploader_antenna\": \"1/4 wave monopole\", \"time_received\": \"2021-12-20T05:23:09.181181Z\", \"datetime\": \"2021-12-20T05:23:25.001000Z\", \"manufacturer\": \"Vaisala\", \"type\": \"RS41\", \"serial\": \"T1310890\", \"subtype\": \"RS41-SGP\", \"frame\": 2796, \"lat\": 49.36909, \"lon\": 7.49908, \"alt\": 13532.5104, \"temp\": -67.0, \"humidity\": 15.5, \"pressure\": 149.64, \"vel_v\": 8.40014, \"vel_h\": 23.5398, \"heading\": 137.35364, \"sats\": 8, \"batt\": 2.7, \"frequency\": 402.7, \"burst_timer\": 15902, \"snr\": 10.1, \"user-agent\": \"Amazon CloudFront\", \"position\": \"49.36909,7.49908\", \"upload_time_delta\": -1.463, \"uploader_alt\": 185.0}, {\"software_name\": \"radiosonde_auto_rx\", \"software_version\": \"1.5.4\", \"uploader_callsign\": \"BARN5\", \"uploader_position\": \"48.950958,6.135996\", \"uploader_antenna\": \"1/4 wave monopole\", \"time_received\": \"2021-12-20T05:23:10.186732Z\", \"datetime\": \"2021-12-20T05:23:26.001000Z\", \"manufacturer\": \"Vaisala\", \"type\": \"RS41\", \"serial\": \"T1310890\", \"subtype\": \"RS41-SGP\", \"frame\": 2797, \"lat\": 49.36894, \"lon\": 7.4993, \"alt\": 13538.89727, \"temp\": -67.0, \"humidity\": 15.3, \"pressure\": 149.5, \"vel_v\": 3.88558, \"vel_h\": 23.33546, \"heading\": 137.92239, \"sats\": 9, \"batt\": 2.7, \"frequency\": 402.7, \"burst_timer\": 15902, \"snr\": 9.9, \"user-agent\": \"Amazon CloudFront\", \"position\": \"49.36894,7.4993\", \"upload_time_delta\": -1.463, \"uploader_alt\": 185.0}, {\"software_name\": \"radiosonde_auto_rx\", \"software_version\": \"1.5.4\", \"uploader_callsign\": \"BARN5\", \"uploader_position\": \"48.950958,6.135996\", \"uploader_antenna\": \"1/4 wave monopole\", \"time_received\": \"2021-12-20T05:23:11.192482Z\", \"datetime\": \"2021-12-20T05:23:27.001000Z\", \"manufacturer\": \"Vaisala\", \"type\": \"RS41\", \"serial\": \"T1310890\", \"subtype\": \"RS41-SGP\", \"frame\": 2798, \"lat\": 49.36878, \"lon\": 7.49952, \"alt\": 13544.98645, \"temp\": -66.9, \"humidity\": 15.1, \"pressure\": 149.29, \"vel_v\": 8.19858, \"vel_h\": 23.61324, \"heading\": 137.41834, \"sats\": 7, \"batt\": 2.7, \"frequency\": 402.7, \"burst_timer\": 15902, \"snr\": 9.9, \"user-agent\": \"Amazon CloudFront\", \"position\": \"49.36878,7.49952\", \"upload_time_delta\": -1.463, \"uploader_alt\": 185.0}, {\"software_name\": \"radiosonde_auto_rx\", \"software_version\": \"1.5.4\", \"uploader_callsign\": \"BARN5\", \"uploader_position\": \"48.950958,6.135996\", \"uploader_antenna\": \"1/4 wave monopole\", \"time_received\": \"2021-12-20T05:23:12.298679Z\", \"datetime\": \"2021-12-20T05:23:28.001000Z\", \"manufacturer\": \"Vaisala\", \"type\": \"RS41\", \"serial\": \"T1310890\", \"subtype\": \"RS41-SGP\", \"frame\": 2799, \"lat\": 49.36863, \"lon\": 7.49974, \"alt\": 13551.28573, \"temp\": -67.0, \"humidity\": 15.1, \"pressure\": 149.2, \"vel_v\": 4.18856, \"vel_h\": 23.79089, \"heading\": 136.0238, \"sats\": 9, \"batt\": 2.8, \"frequency\": 402.7, \"burst_timer\": 15902, \"snr\": 10.2, \"user-agent\": \"Amazon CloudFront\", \"position\": \"49.36863,7.49974\", \"upload_time_delta\": -1.463, \"uploader_alt\": 185.0}, {\"software_name\": \"radiosonde_auto_rx\", \"software_version\": \"1.5.4\", \"uploader_callsign\": \"BARN5\", \"uploader_position\": \"48.950958,6.135996\", \"uploader_antenna\": \"1/4 wave monopole\", \"time_received\": \"2021-12-20T05:23:13.203452Z\", \"datetime\": \"2021-12-20T05:23:29.001000Z\", \"manufacturer\": \"Vaisala\", \"type\": \"RS41\", \"serial\": \"T1310890\", \"subtype\": \"RS41-SGP\", \"frame\": 2800, \"lat\": 49.36848, \"lon\": 7.49997, \"alt\": 13557.41325, \"temp\": -66.9, \"humidity\": 15.1, \"pressure\": 149.09, \"vel_v\": 9.42486, \"vel_h\": 22.75925, \"heading\": 131.82185, \"sats\": 9, \"batt\": 2.8, \"frequency\": 402.7, \"burst_timer\": 15902, \"snr\": 10.2, \"user-agent\": \"Amazon CloudFront\", \"position\": \"49.36848,7.49997\", \"upload_time_delta\": -1.463, \"uploader_alt\": 185.0}, {\"software_name\": \"radiosonde_auto_rx\", \"software_version\": \"1.5.4\", \"uploader_callsign\": \"BARN5\", \"uploader_position\": \"48.950958,6.135996\", \"uploader_antenna\": \"1/4 wave monopole\", \"time_received\": \"2021-12-20T05:23:14.208788Z\", \"datetime\": \"2021-12-20T05:23:30.001000Z\", \"manufacturer\": \"Vaisala\", \"type\": \"RS41\", \"serial\": \"T1310890\", \"subtype\": \"RS41-SGP\", \"frame\": 2801, \"lat\": 49.36835, \"lon\": 7.5002, \"alt\": 13564.25548, \"temp\": -66.9, \"humidity\": 14.9, \"pressure\": 148.94, \"vel_v\": 5.08188, \"vel_h\": 21.98384, \"heading\": 131.45089, \"sats\": 9, \"batt\": 2.7, \"frequency\": 402.7, \"burst_timer\": 15902, \"snr\": 9.9, \"user-agent\": \"Amazon CloudFront\", \"position\": \"49.36835,7.5002\", \"upload_time_delta\": -1.463, \"uploader_alt\": 185.0}, {\"software_name\": \"radiosonde_auto_rx\", \"software_version\": \"1.5.4\", \"uploader_callsign\": \"BARN5\", \"uploader_position\": \"48.950958,6.135996\", \"uploader_antenna\": \"1/4 wave monopole\", \"time_received\": \"2021-12-20T05:23:15.214374Z\", \"datetime\": \"2021-12-20T05:23:31.001000Z\", \"manufacturer\": \"Vaisala\", \"type\": \"RS41\", \"serial\": \"T1310890\", \"subtype\": \"RS41-SGP\", \"frame\": 2802, \"lat\": 49.36822, \"lon\": 7.50043, \"alt\": 13568.25246, \"temp\": -66.9, \"humidity\": 15.0, \"pressure\": 148.83, \"vel_v\": 4.3075, \"vel_h\": 21.67209, \"heading\": 129.45889, \"sats\": 9, \"batt\": 2.7, \"frequency\": 402.7, \"burst_timer\": 15902, \"snr\": 12.3, \"user-agent\": \"Amazon CloudFront\", \"position\": \"49.36822,7.50043\", \"upload_time_delta\": -1.463, \"uploader_alt\": 185.0}, {\"software_name\": \"radiosonde_auto_rx\", \"software_version\": \"1.5.4\", \"uploader_callsign\": \"BARN5\", \"uploader_position\": \"48.950958,6.135996\", \"uploader_antenna\": \"1/4 wave monopole\", \"time_received\": \"2021-12-20T05:23:16.168994Z\", \"datetime\": \"2021-12-20T05:23:32.001000Z\", \"manufacturer\": \"Vaisala\", \"type\": \"RS41\", \"serial\": \"T1310890\", \"subtype\": \"RS41-SGP\", \"frame\": 2803, \"lat\": 49.3681, \"lon\": 7.50066, \"alt\": 13573.57916, \"temp\": -66.8, \"humidity\": 14.6, \"pressure\": 148.63, \"vel_v\": 5.77128, \"vel_h\": 21.90847, \"heading\": 127.22131, \"sats\": 9, \"batt\": 2.7, \"frequency\": 402.7, \"burst_timer\": 15902, \"snr\": 12.3, \"user-agent\": \"Amazon CloudFront\", \"position\": \"49.3681,7.50066\", \"upload_time_delta\": -1.463, \"uploader_alt\": 185.0}, {\"software_name\": \"radiosonde_auto_rx\", \"software_version\": \"1.5.4\", \"uploader_callsign\": \"BARN5\", \"uploader_position\": \"48.950958,6.135996\", \"uploader_antenna\": \"1/4 wave monopole\", \"time_received\": \"2021-12-20T05:23:17.175154Z\", \"datetime\": \"2021-12-20T05:23:33.001000Z\", \"manufacturer\": \"Vaisala\", \"type\": \"RS41\", \"serial\": \"T1310890\", \"subtype\": \"RS41-SGP\", \"frame\": 2804, \"lat\": 49.36798, \"lon\": 7.50091, \"alt\": 13577.87674, \"temp\": -66.8, \"humidity\": 14.5, \"pressure\": 148.56, \"vel_v\": 2.98149, \"vel_h\": 22.32659, \"heading\": 127.16235, \"sats\": 9, \"batt\": 2.8, \"frequency\": 402.7, \"burst_timer\": 15902, \"snr\": 10.1, \"user-agent\": \"Amazon CloudFront\", \"position\": \"49.36798,7.50091\", \"upload_time_delta\": -1.463, \"uploader_alt\": 185.0}, {\"software_name\": \"radiosonde_auto_rx\", \"software_version\": \"1.5.4\", \"uploader_callsign\": \"BARN5\", \"uploader_position\": \"48.950958,6.135996\", \"uploader_antenna\": \"1/4 wave monopole\", \"time_received\": \"2021-12-20T05:23:18.281927Z\", \"datetime\": \"2021-12-20T05:23:34.001000Z\", \"manufacturer\": \"Vaisala\", \"type\": \"RS41\", \"serial\": \"T1310890\", \"subtype\": \"RS41-SGP\", \"frame\": 2805, \"lat\": 49.36786, \"lon\": 7.50115, \"alt\": 13584.40235, \"temp\": -66.7, \"humidity\": 14.2, \"pressure\": 148.36, \"vel_v\": 9.96909, \"vel_h\": 22.43142, \"heading\": 128.7627, \"sats\": 8, \"batt\": 2.8, \"frequency\": 402.7, \"burst_timer\": 15851, \"snr\": 9.6, \"user-agent\": \"Amazon CloudFront\", \"position\": \"49.36786,7.50115\", \"upload_time_delta\": -1.463, \"uploader_alt\": 185.0}, {\"software_name\": \"radiosonde_auto_rx\", \"software_version\": \"1.5.4\", \"uploader_callsign\": \"BARN5\", \"uploader_position\": \"48.950958,6.135996\", \"uploader_antenna\": \"1/4 wave monopole\", \"time_received\": \"2021-12-20T05:23:20.192606Z\", \"datetime\": \"2021-12-20T05:23:36.001000Z\", \"manufacturer\": \"Vaisala\", \"type\": \"RS41\", \"serial\": \"T1310890\", \"subtype\": \"RS41-SGP\", \"frame\": 2807, \"lat\": 49.3676, \"lon\": 7.50162, \"alt\": 13597.72634, \"temp\": -66.7, \"humidity\": 14.4, \"pressure\": 148.11, \"vel_v\": 9.48174, \"vel_h\": 23.08522, \"heading\": 130.91454, \"sats\": 9, \"batt\": 2.7, \"frequency\": 402.7, \"burst_timer\": 15851, \"snr\": 8.2, \"user-agent\": \"Amazon CloudFront\", \"position\": \"49.3676,7.50162\", \"upload_time_delta\": -1.463, \"uploader_alt\": 185.0}, {\"software_name\": \"radiosonde_auto_rx\", \"software_version\": \"1.5.4\", \"uploader_callsign\": \"BARN5\", \"uploader_position\": \"48.950958,6.135996\", \"uploader_antenna\": \"1/4 wave monopole\", \"time_received\": \"2021-12-20T05:23:21.198260Z\", \"datetime\": \"2021-12-20T05:23:37.001000Z\", \"manufacturer\": \"Vaisala\", \"type\": \"RS41\", \"serial\": \"T1310890\", \"subtype\": \"RS41-SGP\", \"frame\": 2808, \"lat\": 49.36746, \"lon\": 7.50187, \"alt\": 13604.03948, \"temp\": -66.7, \"humidity\": 14.3, \"pressure\": 147.96, \"vel_v\": 3.59212, \"vel_h\": 23.53213, \"heading\": 130.71552, \"sats\": 9, \"batt\": 2.7, \"frequency\": 402.7, \"burst_timer\": 15851, \"snr\": 8.8, \"user-agent\": \"Amazon CloudFront\", \"position\": \"49.36746,7.50187\", \"upload_time_delta\": -1.463, \"uploader_alt\": 185.0}, {\"software_name\": \"radiosonde_auto_rx\", \"software_version\": \"1.5.4\", \"uploader_callsign\": \"BARN5\", \"uploader_position\": \"48.950958,6.135996\", \"uploader_antenna\": \"1/4 wave monopole\", \"time_received\": \"2021-12-20T05:23:22.204030Z\", \"datetime\": \"2021-12-20T05:23:38.001000Z\", \"manufacturer\": \"Vaisala\", \"type\": \"RS41\", \"serial\": \"T1310890\", \"subtype\": \"RS41-SGP\", \"frame\": 2809, \"lat\": 49.36733, \"lon\": 7.50211, \"alt\": 13608.1672, \"temp\": -66.7, \"humidity\": 14.4, \"pressure\": 147.89, \"vel_v\": 4.90639, \"vel_h\": 23.74467, \"heading\": 129.53831, \"sats\": 8, \"batt\": 2.7, \"frequency\": 402.7, \"burst_timer\": 15851, \"snr\": 9.5, \"user-agent\": \"Amazon CloudFront\", \"position\": \"49.36733,7.50211\", \"upload_time_delta\": -1.463, \"uploader_alt\": 185.0}]" compressed = BytesIO() with gzip.GzipFile(fileobj=compressed, mode='w') as f: f.write(message.encode('utf-8')) payload = base64.b64encode(compressed.getvalue()).decode("utf-8") #payload = message lambda_handler( {"Records": [ {"body": json.dumps({ "Type" : "Notification", "MessageId" : "ac3ff6e4-dc9b-5429-9867-acdec910f1d3", "TopicArn" : "arn:aws:sns:us-east-1:143841941773:sonde-telem", "Message" : payload, "Timestamp" : "2021-12-20T05:23:23.523Z", "SignatureVersion" : "1", "Signature" : "WHop4RM+0qm/Q/fyvSZ1Zsnu7NXNnQjLqp5UsJy0LXCy51heeHPdg4pOOuOECit/lcmHBXF2w8r2mhqg/3CstP5BClGUNnBFEZ3mUlz9ia1y3LZvBbyl8ls1/fJg39ooULXXfe1I+2NgQD580rV34KMcF6LDuguHmdb++yTLupRvZc9AKlrpY+VYvALE5ZwQTjqZ6+Y1HSqQXvuYj6PTWxJics68ddRv1ddMWS2jXp3N7cLPNbqW0CiiNBNewlMlIXFoGa/liSjai3Ix3YW83HFcFsAE+s4moHhQHx3xmTlmaRhzNwZreF7dzzuv9tZ2zrx51nXqG+0+rf32sQ6MZQ==", "SigningCertURL" : "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-7ff5318490ec183fbaddaa2a969abfda.pem", "UnsubscribeURL" : "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-east-1:143841941773:sonde-telem:1a52ac41-6e17-43da-bfb6-114577c94ca6" })}]} ,{})