cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Python meraki : Unable to claim network device

SOLVED
Highlighted
Conversationalist

Python meraki : Unable to claim network device

Hello,

 

I am trying to claim a network device by using the Python API.

I am using the library "meraki 0.100.2".

 

In this library, I am trying to use the method "claimNetworkDevices(self, networkId: str, **kwargs)", but it doesn't work.

 

Here is my code : 

import meraki

if __name__ == "__main__":


dashboard = meraki.DashboardAPI()
serial = ['****-****-****']
network_id = "N_******************"
dashboard.devices.claimNetworkDevices(network_id,serial)

 I get this error :

dashboard.devices.claimNetworkDevices(network_id,serial)
TypeError: claimNetworkDevices() takes 2 positional arguments but 3 were given

 

I have tried by using different type of serial argument :

serial = {
"serials": [
"****-****-****"
]
}
serial = "****-****-****'
serial = '****-****-****'

 

but I still have the same issue. I checked the method definition in "devices.py", but I didn't help.

 

It works fine when I use POSTMAN with the same request.

 

What am I doing wrong ? Does anyone have the same issue ?

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Meraki Employee

Re: Python meraki : Unable to claim network device

Are you setting the api_key?  I think the code you want looks something like this:

import meraki
api_key = "721e1notmyrealapikeyf72"
dashboard = meraki.DashboardAPI(api_key)

serialnums = ["XXXX-XXXX-XXXX"]
networkid = "L_6notmynetworkid93483"
claimdevice = dashboard.devices.claimNetworkDevices(networkid,serials=serialnums,)

View solution in original post

2 REPLIES 2
Highlighted
Meraki Employee

Re: Python meraki : Unable to claim network device

Are you setting the api_key?  I think the code you want looks something like this:

import meraki
api_key = "721e1notmyrealapikeyf72"
dashboard = meraki.DashboardAPI(api_key)

serialnums = ["XXXX-XXXX-XXXX"]
networkid = "L_6notmynetworkid93483"
claimdevice = dashboard.devices.claimNetworkDevices(networkid,serials=serialnums,)

View solution in original post

Highlighted
Conversationalist

Re: Python meraki : Unable to claim network device

Hello @has_cool_name,

 

My api_key was already set in my environment variable.

 

I tried by using serials=serialnums, and it perfectly worked !

I tried again without specifying serials=, and it didn't work, so that was the thing I wasn't doing right

 

Thank you !

Welcome to the Meraki Community!
To start contributing, simply sign in with your Cisco account. If you don't yet have a Cisco account, you can sign up.