Network static IP devices DNS configuration script

Thibaut-Matzke
Here to help

Network static IP devices DNS configuration script

Hello,


I am currently working on a simple script that provides a user-friendly interface to automatically modify an entire network static IP devices DNS configuration.

 

Here is the repository if you want to check it out & test it :

https://github.com/ThibautMatzke/meraki-automation-dns


On a previous script, I used to test out the api_key validity by using the function meraki.myorgaccess(api_key), but since apiV1, I cannot find any other way than trying to get the organization list with the provided API key.

 

This is what I currently do :

 

# Creates a persistent Meraki Dashboard API session with the given api_key
self._dashboard = meraki.DashboardAPI(api_key=api_key)

try:

# Tries a function to see if the API Key is valid
self._dashboard.organizations.getOrganizations()

# Return true the key is valid
return True

# Catches the error if the API Key isn't valid
except meraki.APIError as e:

# Prints the error message
print(e)

# Returns false if the key is invalid
return False

 

 

 

Does anyone have a better way of testing an api_key validity ?

 

Also, I would like to share this script on Cisco Code Exchange, but since I am totally new, do you have any best practices for this ? Should I wait to implement new features before submitting it ?

 

Thank you in advance for your answers / feedback !

 

0 Replies 0
Get notified when there are additional replies to this discussion.