The proxy you are connecting is not in your list error in GetAuthCredentials callback functiondef main():
check_versions()
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error applicationSettings = {
"unique_request_context_per_browser": 1,
"ignore_certificate_errors": 1, "persist_session_cookies": 1,
"persist_user_preferences": 1,
"string_encoding": "utf-8", "user_agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.106 Safari/537.36",
"context_menu": {
"enabled": True,
"navigation": True,
"print": True,
"view_source": True, "external_browser": True,
"devtools": True,
}
}
commandLineSwitches = {
"proxy-server": "host:port",
"force-webrtc-ip-handling-policy": "default_public_interface_only",
}
cef.Initialize(applicationSettings, commandLineSwitches)
browser.SetClientHandler(RequestHandler("username", "password"))
cef.MessageLoop()
del browser
cef.Shutdown()
class RequestHandler(object):
def __init__(self, username, password):
self.username = username
self.password = password
def GetAuthCredentials(self, browser, is_proxy, **_):
if is_proxy:
resp = _['callback'].Continue(self.username, self.password)
print(_)
print(resp)
return True
return False
def check_versions():
ver = cef.GetVersion()
assert cef.__version__ >= "57.0", "CEF Python v57.0+ required to run this"
if __name__ == '__main__':
main()
That's what i get in the command line (infinite loop):
{'frame': <cefpython_py39.PyFrame object at 0x0000023E38F0B380>, 'host': 'host', 'port': port, 'realm': 'Invalid proxy credentials or missing IP Authorization.', 'scheme': 'basic', 'callback': <cefpython_py39.PyAuthCallback object at 0x0000023E36A87E30>}
None
{'frame': <cefpython_py39.PyFrame object at 0x0000023E38F0B3C0>, 'host': 'host', 'port': port, 'realm': 'The proxy you are connecting is not in your list.', 'scheme': 'basic', 'callback': <cefpython_py39.PyAuthCallback object at 0x0000023E36A87E30>}
None
{'frame': <cefpython_py39.PyFrame object at 0x0000023E38F0B3C0>, 'host': 'host', 'port': port, 'realm': 'The proxy you are connecting is not in your list.', 'scheme': 'basic', 'callback': <cefpython_py39.PyAuthCallback object at 0x0000023E36A87E30>}
None
Cannot find any working solution for that. Maybe i'm missing something obvious, thanks for help in advance!