code: def parse_sentry_configuration(filename):
      
      filetype = os.path.splitext(filename)[-1][1:].lower()
  
      if filetype == 'ini':  # Pyramid, Pylons
          config = ConfigParser()
          config.read(filename)
          ini_key = 'dsn'
          ini_sections = ['sentry', 'filter:raven']
  
          for section in ini_sections:
              if section in config:
                  print('- Using value from [{section}]:[{key}]'
                        .format(section=section, key=ini_key))
                  try:
                      return config[section][ini_key]
                  except KeyError:
                      print('- Warning: Key "{key}" not found in section '
                            '[{section}]'.format(section=section, key=ini_key))
          raise SystemExit('No DSN found in {file}. Tried sections [{sec_list}]'
                           .format(
                               file=filename,
                               sec_list='], ['.join(ini_sections),
                           ))
      elif filetype == 'py':  # Django, Flask, Bottle, ...
          raise SystemExit('Parsing configuration from pure Python (Django,'
                           'Flask, Bottle, etc.) not implemented yet.')
      else:
          raise SystemExit('Configuration file type not supported for parsing: '
                           '%s' % filetype)
docs: Parse Sentry DSN out of an application or Sentry configuration file