29 lines
642 B
Python
29 lines
642 B
Python
|
#!/usr/bin/env python
|
||
|
import argparse
|
||
|
import os
|
||
|
import sys
|
||
|
sys.path.append("..")
|
||
|
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "dnmapper.settings")
|
||
|
import django
|
||
|
django.setup()
|
||
|
|
||
|
from backend.crawler import convert_crawl
|
||
|
from bgpdata.models import CrawlRun
|
||
|
|
||
|
|
||
|
def main():
|
||
|
parser = argparse.ArgumentParser()
|
||
|
parser.add_argument("-c", "--crawl-id", type=int)
|
||
|
args = parser.parse_args()
|
||
|
|
||
|
try:
|
||
|
crawl = CrawlRun.objects.get(pk=args.crawl_id)
|
||
|
except CrawlRun.DoesNotExist:
|
||
|
parser.error("CrawlRun with id {} does not exist".format(args.crawl_id))
|
||
|
|
||
|
convert_crawl(crawl)
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
main()
|