Converts dict_keys object to list (py3)

In python 3, keys() method returns a dict_keys object instead of a list. Trying to access the zero index causes an error. Converting the dict_keys object to a list is enough to make it work (and still works in python 2).
This commit is contained in:
Ederson Peka
2020-04-16 20:42:07 -03:00
committed by GitHub
parent e7dc64f114
commit 3cbaa7eb5f
+1 -1
View File
@@ -109,7 +109,7 @@ def saml2_handler(session, request, config_filename = None, entityid = None):
client = Saml2Client(config_file = config_filename)
if not entityid:
idps = client.metadata.with_descriptor("idpsso")
entityid = idps.keys()[0]
entityid = list(idps.keys())[0]
bindings = [BINDING_HTTP_REDIRECT, BINDING_HTTP_POST]
binding, destination = client.pick_binding(
"single_sign_on_service", bindings, "idpsso", entity_id=entityid)