Commit f699df3c authored by Okhin's avatar Okhin

Fixing the loads from a gzip.read()

parent 65777597
Pipeline #1179 passed with stage
in 17 seconds
# -*- coding: utf-8 -*-
import gzip
import json
import re
import os
from scrapy import Request
......@@ -61,7 +60,7 @@ class VoteSpider(BaseSpider):
f.flush()
os.fsync(f.fileno())
os.rename('%s.tmp.gz' % outfile, '%s.gz' % outfile)
os.rename('%s.tmp.gz' % outfile, '%s.gz' % outfile)
def get_votes(self, scrutin):
'''
......@@ -90,9 +89,8 @@ class VoteSpider(BaseSpider):
raise Exception('Fichier %s inexistant' % infile)
with gzip.open(infile, 'rb') as f:
scrutins = json.loads(f.read())
scrutins = json.loads(f.read().decode())
reloaded = []
for scrutin in scrutins:
if self.has_votes(scrutin):
# Le scrutin a déjà des votes, on les recharge
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment