Needed Python AWS Lambda Edge Script
Budget: $30 – $250 USD
Looking for someone to help with this script. There will be more tasks like this after.
Need to have a Python script that works with Lambda Edge for Origin Response that makes a request for a third party js file,
Using these libs:
import urllib3
import zlib
import base64
import gzip
Example HTTP Request with some-what pesudo code:
http = urllib3.PoolManager()
URL = 'https://securepubads.g.doubleclick.net/tag/js/gpt.js'
r = http.request('GET', URL)
body = does_string_manipluation_returns_string(data.r.decode('utf-8'))
# need to encode and gzip body and update the response return for proper content-type
return
'status': '200',
'statusDescription': 'OK',
'headers':
'Content-Type':
'key': 'Content-Type',
'value': 'text/javascript'
,
'Cache-Control':
'key': 'Cache-Control',
'value': ttl
,
'Content-Encoding':
'key': 'Content-Encoding',
'value': 'gzip'
,
'Access-Control-Allow-Origin':
'key': 'Access-Control-Allow-Origin',
'value': '*'
,
"body": body,
"isBase64Encoded": 'false'
The gpt.js should be Gzip or Brotli based on the user header stated browser support.
Need to have a Python script that works with Lambda Edge for Origin Response that makes a request for a third party js file,
Using these libs:
import urllib3
import zlib
import base64
import gzip
Example HTTP Request with some-what pesudo code:
http = urllib3.PoolManager()
URL = 'https://securepubads.g.doubleclick.net/tag/js/gpt.js'
r = http.request('GET', URL)
body = does_string_manipluation_returns_string(data.r.decode('utf-8'))
# need to encode and gzip body and update the response return for proper content-type
return
'status': '200',
'statusDescription': 'OK',
'headers':
'Content-Type':
'key': 'Content-Type',
'value': 'text/javascript'
,
'Cache-Control':
'key': 'Cache-Control',
'value': ttl
,
'Content-Encoding':
'key': 'Content-Encoding',
'value': 'gzip'
,
'Access-Control-Allow-Origin':
'key': 'Access-Control-Allow-Origin',
'value': '*'
,
"body": body,
"isBase64Encoded": 'false'
The gpt.js should be Gzip or Brotli based on the user header stated browser support.