Closed jonasao closed 6 years ago
What is in your self._data
? Which attribute are you trying to get?
>>> user_obj = user.get_user(attr_map={'given_name': 'firstname', 'family_name': 'lastname'})
>>> user_obj._data
{'email': '111@zzz.co,', 'firstname': 'Jenkins'}
>>> user_obj.firstname
'Jenkins'
self.data
exposes the correct list of AWS Cognito attributes I am asking for, with the correct mapping of attribute names, according to the specifications mentioned above.
{
'email': '....@gmail.com',
'lastname': 'Ols...', 'firstname': 'Jon.....',
'custom:kit_app2': 'M24',
'custom:kit_app1': 'DM'
}
My problem is that all these values resides in a "private" object, not exposed via normal properties or "getter" methods.
It should be exposed as an attribute if it's in self._dict
or self._metadata
. Can you try to debug the __getattr__
method?
https://github.com/capless/warrant/blob/d109924e9e2a2cad34eb0f539f7491cef7585dbf/warrant/__init__.py#L64-L68
I am able to get the values via the self.__getattr__()
method, but this is still i private method. Shouldn't this method have been a public method of the user object?
self.__getattr__(self, 'attribute_name')
is equal to self.attribute_name
if self.attribute_name
wasn't defined.
Ah, of course, my bad. Thanks!
I am attempting to read user information from AWS Cognito using the get_user() method, but I am unsure if it works as expected.
What I am doing:
I would have expected this method call to expose the values of 'firstname' and 'lastname' as separate properties, or as a single "data" property of the object "user", but unfortunately - no.
The values are only exposed via the user._data private property. Is this a bug, or am I missing something?