[Tutor] missing idlelib and pip

2017-10-31 Thread Paul Simon
The python distribution for the Mageia 6 update does not include idlelib 
or pip.  Please tell me where to find them to add.


This seems to be a constant issue with linux distributions of python.  I 
tried to have idlelib added to the Mageia 6 update and all I got was 
vague noise and nothing done.


Paul Simon

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


Re: [Tutor] request.post in If condition

2017-10-31 Thread Mike Miller
What do you mean when you say it is not hitting? Is there a specific error,
or are you saying it simply isn't posting to your site?

Mike

On Mon, Oct 30, 2017, 8:21 AM sourav voip  wrote:

> Hi All,
>
> I'm trying to hit request.post with condition using if-else as below...
> I;m posting the full script here...as I've tried declaring post url details
> tested with multiple places..
>
> If condition for disk utiliztion is working perfect ,however request.post
> is not hitting.
> Please suggest any hint/clue as I'm a new learner in python.
>
> Regards,
> Sourav
>
> 
> -
> #!/usr/bin/python
> import re,sys,commands
> import requests
> # Set the request parameters
> url = 'https://dev.service-now.com/api/now/table/incident'
>
> # Eg. User name="admin", Password="admin" for this code sample.
> user = 'admin'
> pwd = ''
>
> # Set proper headers
> headers = {"Content-Type":"application/json","Accept":"application/json"}
>
>
> #
> #Set variables
> command = "df /"
> critical = 50.0
> warning = 40.0
> #
>
> #build regex
> dfPattern = re.compile('[0-9]+')
>
> #get disk utilization
> diskUtil = commands.getstatusoutput(command)
>
> #split out the util %
> diskUtil = diskUtil[1].split()[11]
>
> #look for a match. If no match exit and return an
> #UNKNOWN (3) state to Nagios
>
> matchobj = dfPattern.match(diskUtil)
> if (matchobj):
> diskUtil = eval(matchobj.group(0))
> else:
> print "STATE UNKNOWN"
> sys.exit(3)
>
> #Determine state to pass to Nagios
> #CRITICAL = 2
> #WARNING = 1
> #OK = 0
> if diskUtil >= critical:
> url = 'https://dev.service-now.com/api/now/table/incident'
> user = 'admin'
> pwd = ''
> headers = {"Content-Type":"application/json","Accept":"application/
> json"}
> requests.post(url, auth=(user, pwd), headers=headers
> ,data="{\"assignment_group\":\Hardware\",\"short_description\":\"Threshold
> critical\"}")
> print "FREE SPACE CRITICAL: '/' is %.2f%% full" % (float(diskUtil))
> sys.exit(2)
> elif diskUtil >= warning:
> requests.post(url, auth=(user, pwd), headers=headers
> ,data="{\"assignment_group\":\Hardware\",\"short_description\":\"Threshold
> Warning\"}")
> print "FREE SPACE WARNING: '/' is %.2f%% full" % (float(diskUtil))
> sys.exit(1)
> else:
> print "FREE SPACE OK: '/' is %.2f%% full" % (float(diskUtil))
> sys.exit(0)
>
>
> On Mon, Oct 30, 2017 at 4:04 PM, sourav voip 
> wrote:
>
> > Hi All,
> >
> > I'm trying to hit request.post with condition using if-else as below...
> > I;m posting the full script here...as I've tried declaring post url
> > details tested with multiple places.
> >
> >
> >
> >
> >
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


[Tutor] How to schedule the SFTP folder sync using python

2017-10-31 Thread Pareshkumar Panchal
Hi,

can you help me about scheduling the folder sync between sftp and local
directory?

pysftp library is good or you recommend different library?

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