@@ -0,0 +1,1638 @@
+#!/usr/bin/python3%0A%0Aimport click%0Afrom pdc_client import PDCClient%0Aimport yaml%0Atry:%0A    from yaml import CLoader as Loader, CDumper as Dumper%0Aexcept ImportError:%0A    from yaml import Loader, Dumper%0A%0Adef get_modulemd(module_name, stream):%0A    %22%22%22%0A    Check if module and stream are built successfully on PDC server%0A    %22%22%22%0A    pdc_server = %22https://pdc.fedoraproject.org/rest_api/v1/unreleasedvariants%22%0A    #Using develop=True to not authenticate to the server%0A    pdc_session = PDCClient(pdc_server, ssl_verify=True, develop=True)%0A    pdc_query = dict(%0A        variant_id = module_name,%0A        variant_version = stream,%0A        fields=%22modulemd%22,%0A        ordering=%22variant_release%22,%0A        #active=True returns only succesful builds%0A        active = True,%0A    )%0A    try:%0A        mod_info = pdc_session(**pdc_query)%0A    except Exception as ex:%0A        raise IOError(%22Could not query PDC server for %25s (stream: %25s) - %25s%22 %25 (%0A                       module_name, stream, ex))%0A    if not mod_info or %22results%22 not in mod_info.keys() or not mod_info%5B%22results%22%5D:%0A        raise IOError(%22%25s (stream: %25s) is not available on PDC%22 %25 (%0A                       module_name, stream))%0A    return mod_info%5B%22results%22%5D%5B-1%5D%5B%22modulemd%22%5D%0A%0A@click.command()%0A@click.option('--module', default='base-runtime',%0A              help='The module to get the API from')%0A@click.option('--ref', default='f26',%0A              help='The ref of the module to retrieve')%0Adef main(module, ref):%0A    modulemd = yaml.load(get_modulemd(module, ref), Loader=Loader)%0A%0A    for rpm in sorted(modulemd%5B'data'%5D%5B'api'%5D%5B'rpms'%5D):%0A        print(rpm)%0A%0A%0Aif __name__ == %22__main__%22:%0A    main()%0A

Add script to retrieve the RPM API of modules