changeset 1:927553056183 draft

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/facturation_ibps commit 52ed46f7aa2a7b7c1dc478e02b5b53fd0445e155
author artbio
date Tue, 23 Oct 2018 11:13:24 -0400
parents 32b0db39551c
children 3bbcf49ad677
files facturation.py facturation.xml newtests/test.xlsx
diffstat 3 files changed, 8 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/facturation.py	Mon Oct 22 17:17:11 2018 -0400
+++ b/facturation.py	Tue Oct 23 11:13:24 2018 -0400
@@ -1,3 +1,4 @@
+#!/usr/bin/env python2
 # -*- coding: utf-8 -*-
 
 
@@ -25,7 +26,10 @@
     # ouverture fichier input
     with open(input_file, 'r') as file_object:
         facture_html = file_object.read()
-
+    # convert to unicode utf-8, remove &nbsp and €
+    facture_html = facture_html.decode('utf-8')
+    facture_html = facture_html.replace(r' ', r' ')
+    facture_html = facture_html.replace(u' \u20ac', '')
     # parsing de la date et de la période de facturation
     date = re.search(r'Paris le (.*?)</p>'.decode('utf-8'),
                      facture_html).group(1)
@@ -40,11 +44,8 @@
         flavor='bs4')
     # remove 'Adresse de l'appel à facturation : ' (\xa0:\xa0)
     adresse = facture_parsed[0].replace(
-        r"Adresse de l'appel \xe0 facturation\xa0:\xa0", r'', regex=True)
-
-    # supression des symboles € (ça fait planter les calculs dans excel sinon)
-    # ' € ' == \xa0\u20ac
-    elements = facture_parsed[1].replace(r"\xa0\u20ac", r'', regex=True)
+        r"Adresse de l\'appel \xe0 facturation : ", r'', regex=True)
+    elements = facture_parsed[1]
 
     # conversion des noms de colonnes
     elements_col = elements.iloc[0]
--- a/facturation.xml	Mon Oct 22 17:17:11 2018 -0400
+++ b/facturation.xml	Tue Oct 23 11:13:24 2018 -0400
@@ -1,4 +1,4 @@
-<tool id="facturation_ibps" name="IBPS facturation parser" version="0.2.1">
+<tool id="facturation_ibps" name="IBPS facturation parser" version="0.3.0">
     <description />
     <requirements>
             <requirement type="package" version="4.6.3=py27_0">beautifulsoup4</requirement>
Binary file newtests/test.xlsx has changed