Skip to content

Commit

Permalink
upgrading inspector to python 3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
himanshu219 committed Apr 21, 2021
1 parent 8177515 commit 343e731
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions inspector/python/inspector.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@

import json
import httplib
import http.client
import base64,zlib
import urlparse
import urllib.parse
import boto3
import datetime
import logging
Expand All @@ -19,7 +19,7 @@
##################################################################
# Main Code #
##################################################################
up = urlparse.urlparse(sumoEndpoint)
up = urllib.parse.urlparse(sumoEndpoint)
options = { 'hostname': up.hostname,
'path': up.path,
'method': 'POST'
Expand All @@ -33,7 +33,7 @@

# main function to send data to a Sumo HTTP source
def sendSumo(msg, toCompress = False):
conn = httplib.HTTPSConnection(options['hostname'])
conn = http.client.HTTPSConnection(options['hostname'])
if (toCompress):
headers = {"Content-Encoding": "gzip"}
finalData = compress(msg)
Expand All @@ -50,7 +50,7 @@ def sendSumo(msg, toCompress = False):
# Simple function to compress data
def compress(data, compresslevel=9):
compress = zlib.compressobj(compresslevel, zlib.DEFLATED, 16 + zlib.MAX_WBITS, zlib.DEF_MEM_LEVEL, 0)
compressedData = compress.compress(data)
compressedData = compress.compress(data.encode())
compressedData += compress.flush()
return compressedData

Expand Down

0 comments on commit 343e731

Please sign in to comment.