14 lines
390 B
Python
14 lines
390 B
Python
"""Outputters take scraped objects and save them to a certain format."""
|
|
|
|
from . import json, pickle
|
|
|
|
OUTPUTTERS = [json, pickle]
|
|
|
|
def get_outputter(name):
|
|
"""Get the outputter with the specified name."""
|
|
for outputter in OUTPUTTERS:
|
|
if outputter.__name__.endswith(".{}".format(name)):
|
|
return outputter
|
|
|
|
raise Exception("Unknown outputter: {}".format(name))
|