Comments (5)
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:
{
'metadata': {
'total_objects': 12
},
'response': [{
<list of users>
}],
'stat': 'OK'
}
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!
from duo_client_python.
Sorry for the delay
I was testing using the Trust Monitor event logs, I get a response like this:
{
"response": {
"events": [...],
"metadata": { "next_offset": "1211416" }
},
"stat": "OK"
}
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.
from duo_client_python.
@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.
from duo_client_python.
@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)
from duo_client_python.
@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!
from duo_client_python.
Related Issues (20)
- Add Support Create Integration for SSO type HOT 5
- Update Admin cannot update the status HOT 1
- Deprecated SSL protocol in CertValidatingHTTPSConnection HOT 4
- 403 Forbidden Access on all methods of Admin API HOT 6
- Duo: no library to generate passcodes HOT 4
- get_authentication_log - api:v2 param filter failing HOT 4
- metadata parse error in add_user_phone HOT 4
- Automatic proxy configuration HOT 2
- get_authentication_log clearing out Params HOT 3
- Add Get User by Email HOT 1
- 400 Bad Request response when trying to add a token for a yubikey HOT 1
- Duo client installed via pip is missing the get_users_by_names func HOT 3
- Getting "Received 429 Too Many Requests" for auth logs even if hitting the API in 6-7 minute intervals
- Getting 40103 on making GET REST API calls HOT 5
- Tests are failing because actual requests are being made HOT 1
- How to use duo_client_python to access an integrations secret key? HOT 2
- next_offset pagination in auth logs HOT 12
- add get auth summary endpoint to the admin object
- bad link in READ.me
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from duo_client_python.