On Thu, Dec 06, 2018 at 08:17:23AM -0600, Ravi Kumar wrote:

> I know I am asking a lot 

Yes you are. Please read this:

http://sscce.org/


It is written for Java programmers, but it applies equally to all 
languages, including Python.

Think about how difficult a job you are giving us: we don't have access 
to your network; we don't have the API key (which is understandable); we 
can't run the code; we can't even be confident that the code you give us 
is the same code you are running.

In fact we know that it cannot be the same code, because what you have 
given us has a Syntax Error in line 8:

> organization='4

(missing quote mark). Where there is one change to the code, there could 
be dozens for all we know.


> but I hit a road block on this i am assuming One
> small change in my last for loop I can get this working for all devices

That doesn't seem like a reasonable assumption to me. You might be 
right, or it could take many large changes.


> and
> I have hardcoded for one network how do I use the same code for different
> networks as well

You can read the network from the command line, or a config file, or an 
environment variable, or interactively by asking the user to enter the 
network using the "input" (Python 3) or "raw_input" (Python 2) 
functions.

I expect that you need more than one piece of information to change the 
network, it looks like you probably need at least four:

serveraddress
merakiAPIkey
organization
networkid

so it probably is best to read the details from a config file:

https://docs.python.org/3/library/configparser.html

is probably simplest, but you could use Property Lists as well:

https://docs.python.org/3/library/plistlib.html




-- 
Steve
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to