| 123456789101112131415161718192021222324252627282930 |
- import json
- import urllib.request
- import urllib.parse
- import base64
- import gzip
- def lambda_handler(event, context):
-
- game_id=456
- user_id=123
- url = "http://onlyellow.cstor.cn:18888/launch_refund"
-
- de_content = base64.b64decode(event['awslogs']['data'])
- ret = json.loads(gzip.decompress(de_content).decode('utf8'))
- log_msg = ret['logEvents'][0]['message']
- tup_log = log_msg.split(' ', -1)
- if len(tup_log[5]) == 36:
- refund_id = tup_log[5]
- data = json.dumps({"user_id":user_id, "game_id":game_id, "refund_id":refund_id})
- last_data=bytes(data,encoding='utf-8')
- headers = {"Content-Type":'application/json'}
- req = urllib.request.Request(url=url, headers=headers, data=last_data)
- response = urllib.request.urlopen(req)
- print(response.read().decode('utf-8'))
- else:
- print('hhhhhhhhhhhhaaaaaaaaaa')
|