You should consider using DevNetUI. It makes tasks like this simple and puts it in a webUI as well. Includes working examples of SSH and API calls among tons of other things and deployable working apps in seconds. www.devnetui
Most Cisco devices support API. It would probably be easier to identify which devices don't in your list then those that do. Consider using DevNetUI. It makes it allot easier and more reusable if you are journeying into python backed programmability ...