def execute_scraping_order(order, shapefile_path): order_id = order['id'] latitude = order['latitude'] longitude = order['longitude'] crawl(order_id, latitude, longitude) check_zip_download_finished(temp_dir) print(">>> Download finished.") downloaded_file = glob.glob("./{}*.zip".format(TEMP_DIR))[0] download_file_path = os.path.join(download_dir, str(datetime.now())) print(">>> Cleaning the file.") clean_file(downloaded_file, download_file_path) upload_filename = "{}.tif".format(str(datetime.now())) upload_file_path = glob.glob("{}/*.tif".format(download_file_path))[0] print(">>> Cropping the raster.") crop_raster(upload_file_path, shapefile_path, upload_file_path) print(">>> Uploading the file.") upload_file(upload_filename, upload_file_path, order_id) print(">>> Finished.")
def create_result_page(): html = generate_page() uploader.upload_file(RESULT_BUCKET, 'matchpage.html', html) with open('frontpage_include.js', 'r') as f: uploader.upload_file( RESULT_BUCKET, 'frontpage_include.js', f.read(), content_type='application/javascript', )
def upload_file(filename, existing_file=False): uploader.upload_file(filename, existing_file)
def create_result_box_page(): f = datetime.datetime.now() - datetime.timedelta(days=30) t = datetime.datetime.now() + datetime.timedelta(days=30) games = get_games(f, t, hsi, ksi) uploader.upload_file(RESULT_BUCKET, 'index.html', get_html(games))
def upload(self, uploader): if not self.local_zip_path: raise HandledError("A local zip was not found") print "uploading {}".format(self.local_zip_path) return uploader.upload_file(UPLOADED_FILE_FORMAT.format(self.function_name), self.local_zip_path)["key"]
def index(): upload_file() return render_template('index.html')