mirror of
https://github.com/scrapy/scrapy.git
synced 2025-02-25 23:04:16 +00:00
removed old serializators from newitem
This commit is contained in:
parent
3c4afb23be
commit
6eb2609d1e
@ -1,18 +0,0 @@
|
||||
import simplejson
|
||||
|
||||
from scrapy.utils.serialization import ScrapyJSONEncoder
|
||||
|
||||
|
||||
def item_to_dict(item):
|
||||
"""Returns a dict representation of an item"""
|
||||
res = {}
|
||||
for field in item.fields:
|
||||
res[field] = getattr(item, field)
|
||||
|
||||
return res
|
||||
|
||||
|
||||
def item_to_json(item):
|
||||
"""Returns a json representation of an item"""
|
||||
return simplejson.dumps(item_to_dict(item), cls=ScrapyJSONEncoder)
|
||||
|
Loading…
x
Reference in New Issue
Block a user