21 lines
539 B
Python
21 lines
539 B
Python
from src.compiler.models import CrawlCache, CrawlCacheSchema
|
|
from src.compiler.models import CrawlUrl, CrawlUrlSchema
|
|
import sys
|
|
import json
|
|
|
|
if len(sys.argv) <= 1:
|
|
raise Error("Kein Zieldateiname angegeben")
|
|
|
|
def dump_crawlurl(a):
|
|
return CrawlUrlSchema().dump(a)
|
|
|
|
def dump_crawlcache(a):
|
|
return CrawlCacheSchema().dump(a)
|
|
|
|
file = open(sys.argv[1], "w+")
|
|
data={}
|
|
data["crawlurls"] = map(dump_crawlurl,CrawlUrl.query.all())
|
|
#data["crawlcache"] = map(dump_crawlcache,CrawlCache.query.all())
|
|
json.dump (data, file)
|
|
file.close()
|