- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
unable to use getOrganizationInventoryDevices.serial(organization_id) to get device serials
Hi All
About 6 months ago I used the following short python script to get a list of all the serials in my organisation - this was then used as input to make some DNS changes on the devices - which worked great.
So 6 months down the line - I need to do the change again as part of a DC migration so I came back to my trusty scripts, however I'm finding that the syntax I used doesnt work anymore. I've updated the python meraki package, but it looks like the function itself has changed - I can't find any supporting documentation that suggests this however - so am at a bit of a loss. I'd appreciate any ideas on this one
Script sample:
import meraki
dashboard = meraki.DashboardAPI(api_key="************************************")
organization_id = '******'
result = dashboard.organizations.getOrganizationInventoryDevices.serial(organization_id)
print(result)
This when piped to a text file gave me a list of all my serials, now when I run it - I get the error:
AttributeError: 'function' object has no attribute 'serial'
Anyone know what's changed?
Thanks in advance
C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ,
Have you tried removing the .serial from the line result = dashboard.organizations.getOrganizationInventoryDevices.serial(organization_id)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
Yes and that works - but it then provides me with all the device information, when all I want is the serials
I'm not sure why it's changed as it worked 6 months ago, I mean if I have to write a foreach loop to extract them all out - then I will, just seems like a PITA tbh.
Thanks
C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That should never have worked. I would expect you would need to loop through the output of getOrganizationInventoryDevices() and print out the serial number field of each device.
Untested, but something more like:
for device in dashboard.organizations.getOrganizationInventoryDevices(organization_id,total_pages='all'):
print(device['serial'])
