-
-
Notifications
You must be signed in to change notification settings - Fork 30.2k
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
Add getprotobynumber to socket module #68997
Comments
Add an old method from netdb to python for a best-effort, centerized look up. For the function to work, /etc/protocols would also need to be present. If the protocol doesn't exist OSError is raised. Patch attached. |
What are the use cases? If it's "(Rarely used.)" (as docstring indicates), then, perhaps, a package on PyPI is a better solution. |
Allow users to translate protocol numbers from IPv4/IPv6 headers to a friendly human readable string. Just filling a gap in the API. There might be a PyPI package out there similar to socket. However, it's complementary function,'getprotobyname', already exist here. getprotobynumber just flips getprotobyname around. |
Any chance this will get accepted? I actually have a use case in Openstack where we might get a protocol number and want to save the name along with it. Right now we're looking at using libc getprotoent() directly which isn't that pretty. Thanks! |
I concur with Yury that there is not enough users and use cases needing this feature, so it doesn't deserve to pay the maintenance burden in the standard library. Start with a project on PyPI. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: