import.py 747 B

12345678910111213141516171819202122
  1. from django.core.management.base import BaseCommand
  2. from glitchtip.importer.importer import GlitchTipImporter
  3. class Command(BaseCommand):
  4. help = "Import data from another GlitchTip instance or Sentry"
  5. def add_arguments(self, parser):
  6. parser.add_argument("url", type=str)
  7. parser.add_argument("auth_token", type=str)
  8. parser.add_argument("organization_slug", type=str)
  9. def handle(self, *args, **options):
  10. url = options["url"].rstrip("/")
  11. if not url.startswith("http"):
  12. url = "https://" + url
  13. importer = GlitchTipImporter(
  14. url, options["auth_token"], options["organization_slug"], create_users=True
  15. )
  16. importer.check_auth()
  17. importer.run()