sendFile.py
39 lines
| 944 B
| text/x-python
|
PythonLexer
r46 | ||||
|
r164 | import optparse, os, sys | ||
|
r165 | pathFile = os.path.dirname(os.path.abspath(__file__)) | ||
|
r164 | sys.path.append(os.path.split(pathFile)[0]) | ||
|
r165 | from bin.client3 import ABSClient | ||
|
r164 | |||
class sendFile(object): | ||||
def __init__(self): | ||||
r169 | self.output = "" | |||
|
r164 | |||
def execute(self, filename): | ||||
if os.path.exists(filename): | ||||
r222 | #absObj = ABSClient(ipDestino="10.10.10.97") | |||
r228 | absObj = ABSClient(ipDestino="10.10.20.27") | |||
r169 | self.output = absObj.sendFile(filename) | |||
|
r165 | #pass | ||
|
r164 | else: | ||
print "No file" | ||||
r169 | ||||
def getOutput(self): | ||||
return self.output | ||||
|
r164 | |||
usage = "::::::::::::\n" | ||||
if __name__ == '__main__': | ||||
parser = optparse.OptionParser(usage=usage) | ||||
parser.add_option("-f", "--filename", dest="filename", type="string", default="", help="Filename") | ||||
(options, args) = parser.parse_args() | ||||
filename = options.filename | ||||
app = sendFile() | ||||
r222 | app.execute(filename) | |||