Re: [Tutor] Regarding Python api script

2018-12-07 Thread Steven D'Aprano
On Fri, Dec 07, 2018 at 12:30:18PM -0500, Avi Gross wrote: > # > I have often seen something like this done with methods, such as to > # > emulate decorator functionality where a method is created in an > # > object with a name > # > and the very next method created has the same name with

Re: [Tutor] Regarding Python api script

2018-12-07 Thread Steven D'Aprano
On Fri, Dec 07, 2018 at 05:59:22PM +, Alan Gauld via Tutor wrote: [...] > > ... In languages without garbage collection, reusing > > the same name, like "index" repeatedly might save some > > small amount of space. > > Garbage collection only helps if the variable loses > its assignment.

Re: [Tutor] Regarding Python api script

2018-12-07 Thread Alan Gauld via Tutor
On 07/12/2018 02:13, Avi Gross wrote: > Alan says he had a challenge evaluating code (below) because the same > variable names were reused It wasn't the reuse per se but the generic nature of the names combined with reuse. Reusing names like i,j,k for simple integer indices etc is not a problem.

Re: [Tutor] Regarding Python api script

2018-12-07 Thread Avi Gross
[[ Real SUBJECT: emulating decorators ]] Steven, I am not suggesting that a particular way of reusing a name is a good idea. I am asking if some ways are encouraged and others are discouraged in the python community. Just to clarify one point you asked about: # > I have often seen something

Re: [Tutor] Regarding Python api script

2018-12-07 Thread Steven D'Aprano
On Thu, Dec 06, 2018 at 09:13:01PM -0500, Avi Gross wrote: > But so much code I see in python does not only reuse the same variable names > but in a confusing way. > > file = "some name" > file = open(file, "r") > file = some_wrapper(file) I agree this is confusing: you have the same name,

Re: [Tutor] Regarding Python api script

2018-12-07 Thread Avi Gross
an argument to replace it. So is there a guide on when reuse is good and when it just obfuscates? What is good practice? -Original Message- From: Tutor On Behalf Of Alan Gauld via Tutor Sent: Thursday, December 6, 2018 7:26 PM To: tutor@python.org Subject: Re: [Tutor] Regarding Python

Re: [Tutor] Regarding Python api script

2018-12-06 Thread Steven D'Aprano
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

Re: [Tutor] Regarding Python api script

2018-12-06 Thread Alan Gauld via Tutor
On 06/12/2018 14:17, Ravi Kumar wrote: > 1)The for loops that have written I am able to access all the networks,able > to loop through all access points(Devices) in the network,able to loop > through and get all clients in each access points but when it comea to > client log events I am able to

Re: [Tutor] Regarding Python api script

2018-12-06 Thread Ravi Kumar
Ya i do know SQL thanks I will look into it but before proceeding I had couple of concerns about my code to geneeate the client log events my concerns 1)The for loops that have written I am able to access all the networks,able to loop through all access points(Devices) in the network,able to

Re: [Tutor] Regarding Python api script

2018-12-05 Thread Alan Gauld via Tutor
CCing the list, please use Reply All when responding to the tutor list. On 05/12/2018 03:44, Ravi Kumar wrote: > Yes  thats right I want to extract the xml and store into database(SQL > Server) and I will have to cteate a new table > > Here is the sample output I am getting similarly there bulk

Re: [Tutor] Regarding Python api script

2018-12-04 Thread Alan Gauld via Tutor
On 04/12/2018 01:31, Ravi Kumar wrote: > My output api calls in python is in xml so I want the output to be in the > database I'm still not 100% clear but I think you are saying that your API currently returns XML when you call it from Python. And you want to extract the data from the XML and

Re: [Tutor] Regarding Python api script

2018-12-04 Thread Ravi Kumar
My output api calls in python is in xml so I want the output to be in the database So is there a way where I can alter my code to get api responses in json format in python and then later move the output to the database Basically at the end of it I want the all the data to be in database

Re: [Tutor] Regarding Python api script

2018-12-04 Thread Alan Gauld via Tutor
CCd the list, please use Reply All when responding to the tutor list. On 04/12/2018 00:52, Ravi Kumar wrote: > Thanks a lot! I was wondering is it easier to access JSON format into > Sql Server from python rather than XML If so how do I format my output > from xml to Json  > JSON is generally

Re: [Tutor] Regarding Python api script

2018-12-03 Thread Alan Gauld via Tutor
On 03/12/2018 22:15, Ravi Kumar wrote: > I have developed a python script to get api calls for meraki > clientlogevents I am wanting the output of apicalls which is in xml format > integrated to sql server management studio how do i do that? XML is such a flexible format that without seeing the

Re: [Tutor] Regarding Python api script

2018-12-03 Thread Steven D'Aprano
On Mon, Dec 03, 2018 at 04:15:51PM -0600, Ravi Kumar wrote: > Hi, > > I have developed a python script to get api calls for meraki > clientlogevents I am wanting the output of apicalls which is in xml format > integrated to sql server management studio how do i do that? What have you tried?

[Tutor] Regarding Python api script

2018-12-03 Thread Ravi Kumar
Hi, I have developed a python script to get api calls for meraki clientlogevents I am wanting the output of apicalls which is in xml format integrated to sql server management studio how do i do that? Thanks ___ Tutor maillist - Tutor@python.org To