GitLab limits the groups to 20 and uses pagination, as described here in the official GitLab API docs:
https://docs.gitlab.com/ee/api/groups.html#namespaces-in-groups
By default, groups only get 20 namespaces at a time because the API
results are paginated.
To get more (up to 100), pass the following as an argument to the
API call:
/groups?per_page=100
The Python GitLab API also supports pagination, as described here in the python-gitlab API docs.
https://python-gitlab.readthedocs.io/en/stable/api-usage.html?highlight=per_page#pagination
Instead of doing the paging manually, the Python API also supports the
all
parameter, which fetches all items from a long list.