div. updates
This commit is contained in:
20
dump_urls.py
Normal file
20
dump_urls.py
Normal file
@@ -0,0 +1,20 @@
|
||||
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()
|
||||
Reference in New Issue
Block a user