# Path: stackimpact/utils.py
# def timestamp():
#     return int(time.time())
# 
# def base64_encode(s):
#     return base64.b64encode(s.encode('utf-8')).decode('utf-8')
# 
# Path: stackimpact/runtime.py
# class runtime_info(object):
#     OS_LINUX = (sys.platform.startswith('linux'))
#     OS_DARWIN = (sys.platform == 'darwin')
#     OS_WIN = (sys.platform == 'win32')
#     PYTHON_2 = (sys.version_info.major == 2)
#     PYTHON_3 = (sys.version_info.major == 3)
#     GEVENT = False


import json
import gzip
import sys
import os
import socket
from io import BytesIO
from .utils import timestamp, base64_encode
from .runtime import runtime_info
    from urllib2 import urlopen
    from urllib2 import Request
    from urllib import urlencode
    from urllib.request import urlopen
    from urllib.request import Request
    from urllib.parse import urlencode




if runtime_info.PYTHON_2:
else:


class APIRequest(object):
    def __init__(self, agent):
        self.agent = agent   

    def post(self, endpoint, payload):
        agent_key_64 = base64_encode(self.agent.get_option('agent_key') + ':').replace('\n', '')
        headers = {
            'Accept-Encoding': 'gzip',
            'Authorization': "Basic %s" % agent_key_64,

# Path: stackimpact/utils.py
# def timestamp():
#     return int(time.time())
# 
# def base64_encode(s):
#     return base64.b64encode(s.encode('utf-8')).decode('utf-8')
# 
# Path: stackimpact/runtime.py
# class runtime_info(object):
#     OS_LINUX = (sys.platform.startswith('linux'))
#     OS_DARWIN = (sys.platform == 'darwin')
#     OS_WIN = (sys.platform == 'win32')
#     PYTHON_2 = (sys.version_info.major == 2)
#     PYTHON_3 = (sys.version_info.major == 3)
#     GEVENT = False


# Path: stackimpact/api_request.py
import json
import gzip
import sys
import os
import socket
from io import BytesIO
from .utils import timestamp, base64_encode
from .runtime import runtime_info
    from urllib2 import urlopen
    from urllib2 import Request
    from urllib import urlencode
    from urllib.request import urlopen
    from urllib.request import Request
    from urllib.parse import urlencode





if runtime_info.PYTHON_2:
else:


class APIRequest(object):
    def __init__(self, agent):
        self.agent = agent   

    def post(self, endpoint, payload):
        agent_key_64 = base64_encode(self.agent.get_option('agent_key') + ':').replace('\n', '')
        headers = {
            'Accept-Encoding': 'gzip',
            'Authorization': "Basic %s" % agent_key_64,

            'Content-Type': 'application/json',