#8952 [src.fedoraproject.org] Pagure Groups json
Closed: Fixed 3 years ago by frantisekz. Opened 3 years ago by frantisekz.

Describe what you would like us to do:


I'd like to ask if it's possible to export list of pagure groups, their members and their packages into json in a similar manner as there is https://src.fedoraproject.org/extras/pagure_owner_alias.json .

Having such json would speed up syncing of packager dashboard as fetching pagure groups is one of the slowest tasks we're periodically running.

I am currently using this code to get the data I need:

def get_pagure_groups():
    """
    Returns dictionary mapping all packager groups in pagure, it's members and packages
    "group_name" : {
        "users": [user_a, ...],
        "packages": [package_a, ...]
    }
    """
    groups_users = {}
    resp = get_json("https://src.fedoraproject.org/api/0/groups?per_page=100") # TODO: Handle pagination properly
    if not resp:
        return None
    for group in resp["groups"]:
        app.logger.debug("Checking out Pagure group %s" % group)
        group_resp = get_json("https://src.fedoraproject.org/api/0/group/%s?projects=1&acl=commit" % group)
        if not group_resp:
            continue
        try:
            groups_users[group] = {
                "users": group_resp["members"],
                "packages": [project["name"] for project in group_resp["projects"]]
            }
        except TypeError:
            app.logger.error("Skipped Pagure group %s because of an error" % group)
            continue
    return groups_users

I can try to write the code myself, if somebody points me out to the code handling pagure_owner_alias.json (I assume it's not created from data obtained by public api).

Thanks a lot!

When do you need this to be done by? (YYYY/MM/DD)


This is not time critical at all.


Metadata Update from @pingou:
- Issue priority set to: Waiting on Assignee (was: Needs Review)
- Issue tagged with: pagure

3 years ago

Metadata Update from @mohanboddu:
- Issue tagged with: groomed, low-gain, low-trouble

3 years ago

@pingou Can we move this to pagure-dist-git repo and close this ticket here?

@frantisekz if you have all the info you need I think we should close this ticket and either open a ticket or a PR to discuss further on https://pagure.io/pagure-dist-git/

What do you think?

@frantisekz if you have all the info you need I think we should close this ticket and either open a ticket or a PR to discuss further on https://pagure.io/pagure-dist-git/
What do you think?

Sure thing!

Thanks :)

Metadata Update from @frantisekz:
- Issue close_status updated to: Fixed
- Issue status updated to: Closed (was: Open)

3 years ago

Login to comment on this ticket.

Metadata