Something went wrong on our end
Forked from
Théo Pirkl / Inari
89 commits behind the upstream repository.
-
Théo Pirkl authoredThéo Pirkl authored
starters.py 1.35 KiB
# Starts the FAO Geneve
import os
from collections import OrderedDict
from os import getenv as env
from loguru import logger
from client.spiders.seleniumspiders.SwissImpex.Parser import Parser
from common.utils.FileParser import FileParser
from common.utils.RegexParser import RegexParser
from common.utils.XLSXParser import XLSXParser
def startFAOGeneve(pages):
logger.warning("Starting scrapy. Since this is a third party, logs will not be kept here.")
if isinstance(pages, list):
pages = ",".join(pages)
os.system("cd src/client/spiders/scrapy && {} crawl FAOGeneve -a pages="
.format(env("SCRAPY_BIN")) + str(pages))
def startSwissImpex(merchID: str, year: int, month: int, webServerPort: int):
logger.debug("Starting Swiss Impex Parser...")
parser = Parser(merchID, year, month)
return parser.parse(webServerPort)
def startXSLXParser(file: str, instructions: OrderedDict, sheetIndex: str, assistedSpliceData: list):
logger.debug("Starting XSLX Parser...")
parser = XLSXParser(file)
return parser.run(instructions, sheetIndex, assistedSpliceData)
def startFileParser(file: str, instructions: OrderedDict):
logger.debug("Starting File parser...")
parser = FileParser(file)
return parser.run(instructions)
def startRegexParser(file: str, regex: str):
logger.debug("Starting RegExp parser...")
parser = RegexParser(file)
return parser.run(regex)