diff --git a/django/contrib/sitemaps/management/commands/ping_google.py b/django/contrib/sitemaps/management/commands/ping_google.py index 3d5b95d6c7..0cac49f13b 100644 --- a/django/contrib/sitemaps/management/commands/ping_google.py +++ b/django/contrib/sitemaps/management/commands/ping_google.py @@ -5,9 +5,8 @@ from django.contrib.sitemaps import ping_google class Command(BaseCommand): help = "Ping Google with an updated sitemap, pass optional url of sitemap" + def add_arguments(self, parser): + parser.add_argument('sitemap_url', nargs='?', default=None) + def execute(self, *args, **options): - if len(args) == 1: - sitemap_url = args[0] - else: - sitemap_url = None - ping_google(sitemap_url=sitemap_url) + ping_google(sitemap_url=options['sitemap_url'])