def add_auth(self, host, headers):
        url = "http://%s" % host
        parsed = urlparse.urlparse(url)
        if parsed.username and parsed.password:
            auth = "%s:%s" % (parsed.username, parsed.password)
            headers["HTTP_AUTHORIZATION"] = "Basic %s" % base64.b64encode(auth)
Add Basic authentication information to the headers if it is given
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/common/utils/transport.py/TestClientTransport.add_auth