Commit 65777597 authored by Okhin's avatar Okhin

We need to send bytes to gzip.write()

parent a57380f5
Pipeline #1177 passed with stage
in 13 seconds
......@@ -28,7 +28,7 @@ class FrancedataPipeline(object):
self.json = gzip.open(outfile, 'wb')
def spider_opened(self, spider):
self.json.write('['.encode())
self.json.write('['.encode('utf-8'))
try:
spider.set_pipeline(self)
......@@ -43,9 +43,10 @@ class FrancedataPipeline(object):
self.urls.add(item['url'])
if self.has_items:
self.json.write(',\n'.encode())
self.json.write(',\n'.encode('utf-8'))
json.dump(item, self.json, cls=ScrapyJSONEncoder)
self.json.write(json.dumps(item,
cls=ScrapyJSONEncoder).encode('utf-8'))
self.has_items = True
return item
......
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