Skip to content
Snippets Groups Projects
Commit 8c429756 authored by Nils Breyer's avatar Nils Breyer
Browse files

v1.0.0; create output dir of not exists

parent 85fb8c70
No related branches found
No related tags found
No related merge requests found
# Changelog
## 1.0.0 (2022-01-13)
* NEW: Create output directory if not existing
## 0.9.9 (2022-02-04)
* FIX: Streaming connection does not return any events
......
......@@ -12,7 +12,7 @@ from crawler import StreamCrawler
import crawler.trafikverket
VERSION = "0.9.9"
VERSION = "1.0.0"
parser = argparse.ArgumentParser(description="Crawler for Trafikverket's Trafikinfo API - version " + VERSION)
......@@ -86,8 +86,14 @@ if args.output is None:
else:
#specified, check if exists
if not os.path.isdir(args.output):
print("The output path {output} does not exist.".format(output=args.output))
exit(-1)
print("The output path {output} does not exist and will be created.".format(output=args.output))
try:
os.makedirs(args.output)
print("The output path {output} has been created.".format(output=args.output))
except Exception as e:
print("The output path {output} could not be created: {exception}".format(output=args.output, exception=e))
exit(-1)
if not args.webhook is None and not validators.url(args.webhook):
print("Webhook is not a valid URL.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment