Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REST API is missing package_roles info from XML-RPC #9700

Open
4383 opened this issue Jun 21, 2021 · 9 comments
Open

REST API is missing package_roles info from XML-RPC #9700

4383 opened this issue Jun 21, 2021 · 9 comments

Comments

@4383
Copy link

4383 commented Jun 21, 2021

Describe the bug
On openstack, we noticed missing data during our transition from the xmlrpc to the restful API.

Indeed, few months ago, we started transitioning github.com/openstack/releases on the restful API.

Previously we relied on the package_role method to retrieve roles. Role is either Maintainer or Owner. The original intent here was to check whether an existing package registration allowed the account used by our automation to upload releases.

Example:

>>> import xmlrpc.client
>>> client = xmlrpc.client.ServerProxy("https://pypi.org/pypi")
>>> client.package_roles('ansible-role-atos-hsm')
[['Owner', 'openstackci']]

Unfortunately the restful API doesn't seems to return similar information. A maintainer field is returned but this one is empty

>>> import requests
>>> data = requests.get('https://pypi.org/pypi/ansible-role-atos-hsm/json')
>>> print(data.json()['info']['maintainer'])

>>> # Empty result

So, we don't know how to finalize our transition without these data.

Expected behavior

Does the fact that the data.json()['info']['maintainer'] is empty is normal?

Do we should expect an empty result here?

Is it possible to bind something else (another JSON key) to retrieve this information?

To Reproduce

By using xmlrpc:

>>> import xmlrpc.client
>>> client = xmlrpc.client.ServerProxy("https://pypi.org/pypi")
>>> client.package_roles('ansible-role-atos-hsm')
[['Owner', 'openstackci']]

By using restful

>>> import requests
>>> data = requests.get('https://pypi.org/pypi/ansible-role-atos-hsm/json')
>>> print(data.json()['info']['maintainer'])

>>> # Empty result

My Platform

Additional context

To see the full context of our transition and the full context of the experienced problem, then, please have a look to https://review.opendev.org/c/openstack/releases/+/785008

Thanks for your help.

@di
Copy link
Member

di commented Jun 21, 2021

The maintainer field in the JSON API corresponds to the Maintainer metadata field that is provided in the package metadata, not the maintainers on PyPI.

There is no equivalent API for package_role.

@4383
Copy link
Author

4383 commented Jun 21, 2021

So, if no equivalent exist, I think that we can close this issue.

Thank you for your reply.

@4383 4383 closed this as completed Jun 21, 2021
@di
Copy link
Member

di commented Jun 21, 2021

We can leave this open to track creation of an equivalent.

@di di reopened this Jun 21, 2021
@4383
Copy link
Author

4383 commented Jun 22, 2021

You mean the creation of an equivalent field (package_role)?
If yes it would be awesome.

4383 added a commit to 4383/warehouse that referenced this issue Jul 8, 2021
These changes adds the `package_roles` as results of the return of the
`admin.views.project` restful API.

The `package_roles` method was available into the xmlrpc, unfortunately
these informations are missing into the restful API [1].

These changes adds the creation of an equivalent into the restful API.

[1] pypi#9700
@abitrolly
Copy link
Contributor

Should this be renamed to "REST API is missing package_roles info from XML-RPC"?

@4383
Copy link
Author

4383 commented Aug 31, 2021

Should this be renamed to "REST API is missing package_roles info from XML-RPC"?

Do you speak about this github issue or do you speak about the github pull request #9770 ?

@abitrolly
Copy link
Contributor

About this GitHub issue. It is quite specific about what info is missing.

@4383 4383 changed the title Missing info when moving From xmlrpc to restful API REST API is missing package_roles info from XML-RPC Sep 1, 2021
@4383
Copy link
Author

4383 commented Sep 1, 2021

Done

@abitrolly
Copy link
Contributor

Now it needs to be linked to some master issue about adding a package Admin API to PyPI, but I can't find any. The closest one is #284 and it is not specific enough to be actionable. In particular it does not separate Metadata API (stuff that comes shipped with code) and Admin API (outside stuff that is needed to manage shipping through PyPI).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants