Add debug mode for GTFS scripts
This commit is contained in:
parent
2277d2fe64
commit
820fc0cc19
|
@ -24,6 +24,7 @@ class Command(BaseCommand):
|
|||
}
|
||||
|
||||
def add_arguments(self, parser):
|
||||
parser.add_argument('--debug', '-d', action='store_true', help="Activate debug mode")
|
||||
parser.add_argument('--bulk_size', type=int, default=1000, help="Number of objects to create in bulk.")
|
||||
parser.add_argument('--dry-run', action='store_true',
|
||||
help="Do not update the database, only print what would be done.")
|
||||
|
|
|
@ -22,9 +22,9 @@ class Command(BaseCommand):
|
|||
}
|
||||
|
||||
def add_arguments(self, parser):
|
||||
pass
|
||||
parser.add_argument('--debug', '-d', action='store_true', help="Activate debug mode")
|
||||
|
||||
def handle(self, *args, **options):
|
||||
def handle(self, debug=False, *args, **options):
|
||||
for feed_type, feed_url in self.GTFS_RT_FEEDS.items():
|
||||
self.stdout.write(f"Updating {feed_type} feed...")
|
||||
feed_message = FeedMessage()
|
||||
|
@ -32,6 +32,10 @@ class Command(BaseCommand):
|
|||
|
||||
stop_times_updates = []
|
||||
|
||||
if debug:
|
||||
with open(f'feed_message-{feed_type}.txt', 'w') as f:
|
||||
f.write(str(feed_message))
|
||||
|
||||
for entity in feed_message.entity:
|
||||
if entity.HasField("trip_update"):
|
||||
trip_update = entity.trip_update
|
||||
|
|
Loading…
Reference in New Issue