示例#1
0
def main(argv):
    import getopt
    user = '******'
    password = ''
    if password == '':
        import getpass
        password = getpass.getpass()

    #openShareFolder(user, password)
    #path = r'\\10.58.0.100\Root\Business_One\Projects\Dev\SDK\KnowledgeWarehouse\_Ebook\java'
    # path = r'//CNST50066074/Root/Business_One/Projects/Dev/SDK/KnowledgeWarehouse/_Ebook/java/m2ebook-pdf.pdf'
    path = r'//pvgn50863254a/share/DOCTEST/newdoc.doc'
    from fetchFile import FetchFile
    fetcher = FetchFile(path, user, password)  #openShareFolder()
    # try:
    s, url, fileType = fetcher.fetchData()
    print type(s)
    print s
    print 'code: ', fetcher.getResponseCode()
    parser = ParserDOCX()
    dicIn = {ParseInputDS.RAWDATA: s}
    outpath = parser.parseContent(dicIn)
    print 'out file:', outpath

    # except Exception as e:
    #     # print 'exception.....', str(e)
    #     raise e
    # s = fetcher.fetchData()
    # print type(s)
    # print s
    print 'code: ', fetcher.getResponseCode()
示例#2
0
def main(argv):
	import getopt
	user = '******'
	password = ''
	if password == '':
		import getpass
		password = getpass.getpass()

	#openShareFolder(user, password)
	#path = r'\\10.58.0.100\Root\Business_One\Projects\Dev\SDK\KnowledgeWarehouse\_Ebook\java'
	# path = r'//CNST50066074/Root/Business_One/Projects/Dev/SDK/KnowledgeWarehouse/_Ebook/java/m2ebook-pdf.pdf'
	path = r'//pvgn50863254a/share/DOCTEST/newdoc.doc'
	from fetchFile import FetchFile
	fetcher = FetchFile(path, user, password) #openShareFolder()
	# try:
	s, url, fileType = fetcher.fetchData()
	print type(s)
	print s
	print 'code: ',fetcher.getResponseCode()
	parser = ParserDOCX()
	dicIn = {ParseInputDS.RAWDATA:s}
	outpath = parser.parseContent(dicIn)
	print 'out file:', outpath

	# except Exception as e:
	#     # print 'exception.....', str(e)
	#     raise e
	# s = fetcher.fetchData()
	# print type(s)
	# print s
	print 'code: ',fetcher.getResponseCode()
示例#3
0
def main(argv):
    import getopt

    def usage():
        print("usage: %s [-u user] [-p password] [-d dir]"
              " file ..." % argv[0])
        return 100

    try:
        opts, args = getopt.getopt(argv[1:], "ho:v",
                                   ["user="******"password="******"dir="])
    except getopt.GetoptError as err:
        print str(err)
        return usage()
    #print opts
    if not opts: return usage()
    user = ""
    password = ""
    dir = ''
    print 'opts', opts
    for (k, v) in opts:
        if k in ("-u", "--user"): user = v
        elif k in ("-p", "--password"): password = v
        elif k in ('-d', "--dir"): dir = v
    if password == '':
        import getpass
        # password = getpass.getpass()
        password = "******"

    #openShareFolder(user, password)
    #path = r'\\10.58.0.100\Root\Business_One\Projects\Dev\SDK\KnowledgeWarehouse\_Ebook\java'
    path = r'//CNST50066074/Root/Business_One/Projects/Dev/SDK/KnowledgeWarehouse/_Ebook/java/m2ebook-pdf.pdf'
    from fetchFile import FetchFile
    fetcher = FetchFile(path, user, password)  #openShareFolder()
    # try:
    s = fetcher.fetchData()
    print type(s)
    print s
    print 'code: ', fetcher.getResponseCode()
    parser = ParserPDF()
    dicIn = {ParseInputDS.RAWDATA: s}
    outpath = parser.parseContent(dicIn)
    print 'out file:', outpath

    # except Exception as e:
    #     # print 'exception.....', str(e)
    #     raise e
    # s = fetcher.fetchData()
    # print type(s)
    # print s
    print 'code: ', fetcher.getResponseCode()
示例#4
0
def main(argv):
	import getopt
	def usage():
		print ("usage: %s [-u user] [-p password] [-d dir]"
			   " file ..." % argv[0])
		return 100

	try:
		opts, args = getopt.getopt(argv[1:], "ho:v", ["user="******"password="******"dir="])
	except getopt.GetoptError as err:
		print str(err)
		return usage()
	#print opts
	if not opts: return usage()
	user = ""
	password = ""
	dir = ''
	print 'opts', opts
	for (k, v) in opts:
		if k in ("-u", "--user") : user = v
		elif k in ("-p", "--password") : password = v
		elif k in ('-d', "--dir") : dir = v
	if password == '':
		import getpass
		# password = getpass.getpass()
		password = "******"

	#openShareFolder(user, password)
	#path = r'\\10.58.0.100\Root\Business_One\Projects\Dev\SDK\KnowledgeWarehouse\_Ebook\java'
	path = r'//CNST50066074/Root/Business_One/Projects/Dev/SDK/KnowledgeWarehouse/_Ebook/java/m2ebook-pdf.pdf'
	from fetchFile import FetchFile
	fetcher = FetchFile(path, user, password) #openShareFolder()
	# try:
	s = fetcher.fetchData()
	print type(s)
	print s
	print 'code: ',fetcher.getResponseCode()
	parser = ParserPDF()
	dicIn = {ParseInputDS.RAWDATA:s}
	outpath = parser.parseContent(dicIn)
	print 'out file:', outpath

	# except Exception as e:
	#     # print 'exception.....', str(e)
	#     raise e
	# s = fetcher.fetchData()
	# print type(s)
	# print s
	print 'code: ',fetcher.getResponseCode()