crawler: fix sqlite/binary issue
parent
21480f90de
commit
f9217102f3
|
@ -494,6 +494,10 @@ class SQLiteCache(BaseCache):
|
||||||
return row[1:]
|
return row[1:]
|
||||||
|
|
||||||
def __setitem__(self, url, value): # value = (code, msg, headers, data, timestamp)
|
def __setitem__(self, url, value): # value = (code, msg, headers, data, timestamp)
|
||||||
|
value = list(value)
|
||||||
|
value[3] = sqlite3.Binary(value[3]) # data
|
||||||
|
value = tuple(value)
|
||||||
|
|
||||||
if url in self:
|
if url in self:
|
||||||
with self.con:
|
with self.con:
|
||||||
self.con.execute('UPDATE data SET code=?, msg=?, headers=?, data=?, timestamp=? WHERE url=?',
|
self.con.execute('UPDATE data SET code=?, msg=?, headers=?, data=?, timestamp=? WHERE url=?',
|
||||||
|
|
Loading…
Reference in New Issue