republique

helper scripts for www.republique-numerique.fr
git clone https://a3nm.net/git/republique/
Log | Files | Refs | README

commit a0fcf3a32d57fee51f4d3b852901cca04c68d6a1
parent 939bf57395e0c5342c20c3d435ebd9226b550320
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Mon, 19 Oct 2015 22:36:17 +0200

fix crash on admincapcollectifcom: check span

Diffstat:
get_votes.py | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/get_votes.py b/get_votes.py @@ -55,6 +55,15 @@ if __name__ == '__main__': break raw_v = None for span in div.find_all('span'): + try: + c = span.get("class") + except KeyError: + continue + if isinstance(c, list): + c = c[0] + if (c != 'label' and c != 'label-success' + and c != "label label-success"): + continue raw_v = span.get('class') break v = KEYS[raw_v[1].split('-')[1]]