Ejemplo n.º 1
0
def gen_small_output(title, location, company, date, thread):
    """Format the output dictionary .

    Args:
    ----
        json_dct: dict
        title: Selenium WebElement
        location: Selenium WebElement
        company: Selenium WebElement
        date: Selenium WebElement
        thread: RequestThreadInfo object

    Return:
    ------
        json_dct: dct
    """

    thread.join()
    new_json = {}
    new_json['nom_du_poste'] = title.text
    new_json['entreprise'] = company.text
    new_json['date_publication'] = date
    try:
        lieu = Cleaner.arrondissement_paris(location.text, thread.posting_txt)
        new_json['lieu'] = lieu
    except:
        pass

    try:
        salaire, contrat = Cleaner.parser(thread.posting_txt)
        new_json['salaire'] = salaire
        new_json['type_de_contrat'] = contrat
    except:
        pass

    try:
        new_json['tags'] = Cleaner.tags(thread.posting_txt)
    except:
        pass

    return new_json