コード例 #1
0
def task5():

    app = QtCore.QCoreApplication.instance()
    if app is None:
        app = QtWidgets.QApplication(sys.argv)
    window = FileDownloader()
    window.show()

    app.exec_()
コード例 #2
0
def download_current_warnings(shapefile_output_directory, logg):

    logg.write_info("calling FileDownloader")
    url = NOAA_URL
    file_downloader = FileDownloader.FileDownloader(
        url, shapefile_output_directory, "current_warnings.zip", True)
    if file_downloader.file_downloaded():
        logg.write_info(
            "downloaded successfully: %s" %
            os.path.join(shapefile_output_directory, "current_warnings.zip"))
    else:
        logg.write_error("current_warnings.zip not downloaded successfully")
        return None

    return file_downloader
コード例 #3
0
import time
import json
from datetime import datetime
import CsvWriter
import FileDownloader

import logging

logging.basicConfig(level=logging.DEBUG,
                    format='%(asctime)s - %(levelname)s - %(message)s')

if __name__ == "__main__":
    writer = CsvWriter.CsvWriter()
    error_writer = CsvWriter.CsvWriter()
    downloader = FileDownloader.FileDownloader()

    writer.header = ['name', 'time', 'bank_name',
                     'account_no', 'ip_address', 'country']
    writer.path = './data.csv'

    error_writer.header = ['name', 'time', 'bank_name',
                     'account_no', 'ip_address', 'country']
    error_writer.path = './data.err.csv'

    data = writer.read()

    writer.path = './data.geolocation.csv'

    failed = []

    for i in range(0, len(data)):
コード例 #4
0
    # save

    scraper.save_output(output_json_path, output_json, pretty_print=True)

# si pas de téléchargement
if download_files == False:
    scraper.close()

# [START] téléchargement des fichiers ----------------------------------------------------------------------------------------------------

else:

    data = scraper.load_output(output_json_path)

    file_downloader = FileDownloader()

    print(str(len(data)) + " produit(s) scrapé(s)")

    for i in range(len(data)):

        # if i <= 906: continue

        product = data[i]

        if product["product_name_complement"] != "":
            formatted_name = product["product_name"] + " " + product[
                "product_name_complement"]
        else:
            formatted_name = product["product_name"]
コード例 #5
0
 fd = FileDownloader({
     'usenetrc':
     opts.usenetrc,
     'username':
     opts.username,
     'password':
     opts.password,
     'quiet':
     (opts.quiet or opts.geturl or opts.gettitle or opts.getthumbnail
      or opts.getdescription or opts.getfilename or opts.getformat),
     'forceurl':
     opts.geturl,
     'forcetitle':
     opts.gettitle,
     'forcethumbnail':
     opts.getthumbnail,
     'forcedescription':
     opts.getdescription,
     'forcefilename':
     opts.getfilename,
     'forceformat':
     opts.getformat,
     'simulate':
     opts.simulate,
     'skip_download':
     (opts.skip_download or opts.simulate or opts.geturl or opts.gettitle
      or opts.getthumbnail or opts.getdescription or opts.getfilename
      or opts.getformat),
     'format':
     opts.format,
     'format_limit':
     opts.format_limit,
     'listformats':
     opts.listformats,
     'outtmpl': ((opts.outtmpl is not None
                  and opts.outtmpl.decode(preferredencoding()))
                 or (opts.format == '-1' and opts.usetitle
                     and u'%(stitle)s-%(id)s-%(format)s.%(ext)s')
                 or (opts.format == '-1' and opts.useliteral
                     and u'%(title)s-%(id)s-%(format)s.%(ext)s')
                 or (opts.format == '-1' and u'%(id)s-%(format)s.%(ext)s')
                 or (opts.usetitle and opts.autonumber
                     and u'%(autonumber)s-%(stitle)s-%(id)s.%(ext)s')
                 or (opts.useliteral and opts.autonumber
                     and u'%(autonumber)s-%(title)s-%(id)s.%(ext)s')
                 or (opts.usetitle and u'%(stitle)s-%(id)s.%(ext)s')
                 or (opts.useliteral and u'%(title)s-%(id)s.%(ext)s')
                 or (opts.autonumber and u'%(autonumber)s-%(id)s.%(ext)s')
                 or u'%(id)s.%(ext)s'),
     'ignoreerrors':
     opts.ignoreerrors,
     'ratelimit':
     opts.ratelimit,
     'nooverwrites':
     opts.nooverwrites,
     'retries':
     opts.retries,
     'continuedl':
     opts.continue_dl,
     'noprogress':
     opts.noprogress,
     'playliststart':
     opts.playliststart,
     'playlistend':
     opts.playlistend,
     'logtostderr':
     opts.outtmpl == '-',
     'consoletitle':
     opts.consoletitle,
     'nopart':
     opts.nopart,
     'updatetime':
     opts.updatetime,
     'writedescription':
     opts.writedescription,
     'writeinfojson':
     opts.writeinfojson,
     'writesubtitles':
     opts.writesubtitles,
     'subtitleslang':
     opts.subtitleslang,
     'matchtitle':
     opts.matchtitle,
     'rejecttitle':
     opts.rejecttitle,
     'max_downloads':
     opts.max_downloads,
     'prefer_free_formats':
     opts.prefer_free_formats,
     'verbose':
     opts.verbose,
 })