Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Added python example

...

Code Block
languagebash
curl -s https://mds.swamid.se/md/swamid-transitive-ds.json | jq '.[] | select ( .registrationAuthority == "http://www.swamid.se/" and .type == "idp" ) | "\(.scope) \(.entityID)"'


And an example with python doing the same.

Code Block
languagepy
#!/usr/bin/env python3
import urllib.request, json
with urllib.request.urlopen("https://mds.swamid.se/md/swamid-transitive-ds.json") as url:
  data = json.load(url)
  for entity in data:
    if ('type' in entity and 'registrationAuthority' in entity and entity['type'] == 'idp' and entity['registrationAuthority'] == 'http://www.swamid.se/') :
      if ('scope' in entity):
        scope = entity['scope']
      else:
        scope = 'Missing'
      print("%s %s" % (scope, entity['entityID']))