background_js = """
var config = {
        mode: "fixed_servers",
        rules: {
          singleProxy: {
            scheme: "http",
            host: "XXX.XXX.XXX.XXX",
            port: parseInt(XXXX)
          },
          bypassList: ["foobar.com"]
        }
      };
chrome.proxy.settings.set({value: config, scope: "regular"}, function() {});
function callbackFn(details) {
    return {
        authCredentials: {
            username: "XXXXXXXXX",
            password: "XXXXXXXXX"
        }
    };
}
chrome.webRequest.onAuthRequired.addListener(
            callbackFn,
            {urls: ["<all_urls>"]},
            ['blocking']
);
"""
pluginfile = 'proxy_auth_plugin.zip'
with zipfile.ZipFile(pluginfile, 'w') as zp:
    zp.writestr('manifest.json', manifest_json)
zp.writestr('background.js', background_js)
co = Options()
co.add_argument('--start-maximized')
co.add_extension(pluginfile)
driver = webdriver.Chrome('path/to/chromedriver', chrome_options=co)
driver.get('http://www.google.com.br')
How can i set proxy with authentication in selenium chrome web driver using python