You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Interators not working due to not having metadata populated #201
The metadata is stored alongside the response. I tested this out by calling duo_client.Admin#get_users and setting a breakpoint at the line you referenced. The data shape looks like:
If there's a particular method/endpoint you find is not working properly, please provide a reduction of the problem as a script that we can run as well so we can investigate. Thank you!
The docs for this endpoint seems to confirm as well, also tested the user's endpoint and can confirm is as you said. So the error seems to be that admin/v1/trust_monitor/events doesn't conform to the standard.
@wisebaldone Thanks for this! I agree that the trust monitor response looks incorrect. Let me get in touch with the appropriate team and see what I can find out.
@wisebaldone After investigating further, I've confirmed this is a bug (no surprise there). Unfortunately, there are other endpoints outside of Trust Monitor Events endpoint affected by this as well, so it's not as simple as "fix one bad endpoint." We're discussing this internally and will fix this, although I cannot give an estimate on exactly when yet.
In the meantime, if you're okay with making some code modifications to get things working, the following patch should do the trick (Fair warning - I didn't test this super thoroughly):
diff --git a/duo_client/client.py b/duo_client/client.py
index 7ed6b32..a2a1f1f 100644
--- a/duo_client/client.py
+++ b/duo_client/client.py
@@ -583,7 +583,13 @@ class Client(object):
data = json.loads(data)
if data['stat'] != 'OK':
raise_error('Received error response: %s' % data)
- return (data['response'], data.get('metadata', {}))
+
+ response = data['response']
+ metadata = data.get('metadata', None)
+ if metadata is None:
+ metadata = response.get('metadata', {})
+
+ return response, metadata
except (ValueError, KeyError, TypeError):
raise_error('Received bad response: %s' % data)
@wisebaldone This bug is fixed with PR #214, which is now on master and will be included in the next release. I'll leave this issue open for now in case you'd like to test the changes on master yourself before the release. I'll close the issue with the next release unless you test and encounter a problem.
Activity
spencermaxfield commentedon Apr 5, 2023
The
metadatais stored alongside theresponse. I tested this out by callingduo_client.Admin#get_usersand setting a breakpoint at the line you referenced. The data shape looks like:If there's a particular method/endpoint you find is not working properly, please provide a reduction of the problem as a script that we can run as well so we can investigate. Thank you!
wisebaldone commentedon Apr 20, 2023
Sorry for the delay
I was testing using the Trust Monitor event logs, I get a response like this:
The docs for this endpoint seems to confirm as well, also tested the user's endpoint and can confirm is as you said. So the error seems to be that admin/v1/trust_monitor/events doesn't conform to the standard.
spencermaxfield commentedon Apr 20, 2023
@wisebaldone Thanks for this! I agree that the trust monitor response looks incorrect. Let me get in touch with the appropriate team and see what I can find out.
spencermaxfield commentedon Apr 21, 2023
@wisebaldone After investigating further, I've confirmed this is a bug (no surprise there). Unfortunately, there are other endpoints outside of Trust Monitor Events endpoint affected by this as well, so it's not as simple as "fix one bad endpoint." We're discussing this internally and will fix this, although I cannot give an estimate on exactly when yet.
In the meantime, if you're okay with making some code modifications to get things working, the following patch should do the trick (Fair warning - I didn't test this super thoroughly):
spencermaxfield commentedon Apr 27, 2023
@wisebaldone This bug is fixed with PR #214, which is now on master and will be included in the next release. I'll leave this issue open for now in case you'd like to test the changes on master yourself before the release. I'll close the issue with the next release unless you test and encounter a problem.
Thank you!