Mercurial > repos > artbio > facturation_ibps
diff facturation.py @ 8:e62e3b548b7e draft default tip
"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 07c73df696d6d80e03f03232603d713882131625"
| author | artbio |
|---|---|
| date | Mon, 11 May 2020 23:35:37 +0000 |
| parents | b8460b9f4253 |
| children |
line wrap: on
line diff
--- a/facturation.py Thu Jan 10 11:19:53 2019 -0500 +++ b/facturation.py Mon May 11 23:35:37 2020 +0000 @@ -3,12 +3,16 @@ import argparse import re +import warnings import openpyxl import pandas as pd +warnings.filterwarnings("ignore") + + def Parser(): the_parser = argparse.ArgumentParser() the_parser.add_argument('--input', '-i', action='store', type=str, @@ -27,7 +31,7 @@ """Script de parsing des fichiers de facturation de l'IBPS""" # ouverture fichier input - with open(input_file, 'r') as file_object: + with open(input_file, 'rb') as file_object: facture_html = file_object.read() # convert to unicode utf-8, remove   and € facture_html = facture_html.decode('utf-8') @@ -35,11 +39,11 @@ facture_html = facture_html.replace(r' €', '') facture_html = facture_html.replace(u' \u20ac', '') # parsing de la référence, de la date et de la période de facturation - date = re.search(r'Paris le (.*?)</p>'.decode('utf-8'), + date = re.search(r'Paris le (.*?)</p>', facture_html).group(1) - periode = re.search(r'de la prestation (.*?)</p>'.decode('utf-8'), + periode = re.search(r'de la prestation (.*?)</p>', facture_html).group(1) - ref = re.search(r'rence interne d.*? :\s*(.*?)<'.decode('utf-8'), + ref = re.search(r'rence interne d.*? :\s*(.*?)<', facture_html).group(1) # parsing des tableaux html avec pandas @@ -68,7 +72,7 @@ # ouverture fichier output facture_output = openpyxl.load_workbook( - template, data_only=False, keep_vba=False) + template, data_only='True', keep_vba=False) ws = facture_output.worksheets[0] # rajout de l'image de SU qui ne survit pas à la conversion
