duosecurity/duo_client_python

Duo client installed via pip is missing the get_users_by_names func

agafonoo opened this issue · 3 comments

duoclient_missing_func

Description

Duo client installed via pip is missing the get_users_by_names function.

Expected Behavior

Expected to call the function get_users_by_names with the username_list param.

Actual Behavior

The Duo client is missing the function.

Steps to Reproduce

Install Duo client via pip and attempt to call admin_api.get_users_by_names(usernames).

Workarounds

The workaround is to call the get_users_by_name repeatedly for a list of users. This is a problem because of API rate limiting.

@agafonoo can you confirm you have version 5.1.0 of the client? That was recently released and is the version where the get_users_by_names function was introduced. I have confirmed locally that the method does exist in that version of the client:

root@49a3f0f35d6d:/# pip3 install duo-client
Collecting duo-client
  Downloading duo_client-5.1.0-py2.py3-none-any.whl (44 kB)

then

root@49a3f0f35d6d:/# python3
Python 3.10.12 (main, Jun 11 2023, 05:26:28) [GCC 11.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import duo_client
>>> dir(duo_client.Admin)

shows (excerpt)

'get_users', 'get_users_by_ids', 'get_users_by_name', 'get_users_by_names', 'get_users_iterator',

Screenshot from 2023-10-11 15-32-35

Via regular pip (not pip3), I get version 5.0.1 of the client. So my workaround could be to just switch to pip3 and install with that. Thank you!

Interesting, I'm not sure why pip vs pip3 would not pull the latest library version - especially since there's been relatively little change between 5.0.1 and 5.1.0. But it sounds like you have a solution, so we won't worry about it unless it comes up for other developers. Thanks for using Duo!