- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Python getting UserID of Guest User with merakiAuthUsers query mail address
Hi,
i am looking for a possibility to query the username of a guest account not the User ID.
I have the following code where i get all users, but i can not find or filter a specific User by filtering the username (mail address) maybe someone can help getting the meraki_auth_user_id by filtering the mail address?
import meraki
API_KEY = 'xxxxxxxxxxxxxx'
dashboard = meraki.DashboardAPI(API_KEY)
network_id = 'xxxxxxxxxxxxxxx'
response = dashboard.networks.getNetworkMerakiAuthUsers(
network_id
)
print (response)
As result, i need the ID of the User by searching after the mail address.
Thanks for any help or advise.
Dennis
Solved! Go to solution.
- Labels:
-
Code Sample
-
Dashboard API
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The most obvious way is to loop thru the user list:
import meraki
API_KEY = 'xxxxxxxxxxxxxx'
dashboard = meraki.DashboardAPI(API_KEY)
network_id = 'xxxxxxxxxxxxxxx'
required_username = 'myuser@name.com'
users = dashboard.networks.getNetworkMerakiAuthUsers(
network_id
)
for user in users:
if user["email"] == required_username:
pprint(user)
Pythonic way would be to substitute the for loop with list comprehension:
myuser = [user for user in users if user["email"]==required_username]
pprint(myuser)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The most obvious way is to loop thru the user list:
import meraki
API_KEY = 'xxxxxxxxxxxxxx'
dashboard = meraki.DashboardAPI(API_KEY)
network_id = 'xxxxxxxxxxxxxxx'
required_username = 'myuser@name.com'
users = dashboard.networks.getNetworkMerakiAuthUsers(
network_id
)
for user in users:
if user["email"] == required_username:
pprint(user)
Pythonic way would be to substitute the for loop with list comprehension:
myuser = [user for user in users if user["email"]==required_username]
pprint(myuser)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Perfect, Thank you so much ! 🙂
It works great!
