-
-
Notifications
You must be signed in to change notification settings - Fork 980
Document the Response.links property
#2783
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
base: master
Are you sure you want to change the base?
Conversation
Response.links property (added in #211)Response.links property
|
Great thanks for taking a look at this. I don't recall what |
it's |
|
Hi, I totally forgot about this PR, sorry!
That's correct, the code defines the type of the We could reflect this by changing line 775 in key = link.get("rel") or link.get("url")to key = link.get("rel") or link["url"]I thought it would be nice to have the narrowed down type available in the documentation already, but I also understand if you would rather have the documentation correctly reflect the typing information as it is given in the code. @tomchristie @trim21 Let me know if or how I should update this PR. |
|
Hello from 2024 :). This is still undocumented, any docs would be better than none, with no docs folks wind up grabbing them from I think the wording in the PR is good as-is, but maybe if more examples are better it could be modified to include the following details? To that end, from the MDN docs you can have multiple instances of a rel per request, which probably would cause bad behavior here. I'd not suggest switching to |
|
Hello from 2025. It took me some time to verify that the LLMs weren't hallucinating. The totally undocumented Response.links attribute does exist and does work. I was so close to acting out @sweeneytr's prediction of googling how to parse Link headers. |
|
Three lines of documentation waiting for 2+ years for inclusion. It's sending a clear message - do not contribute |
In #211 the
Response.linksproperty was added, but so far it's undocumented.In code, the
linksfunction's (correctly) annotated as returning adict[str | None, dict[str, str]], because going only be the typing informationkeyin line 775 could beNone. We know thatparse_header_linkswill always includeurlin its responsedictthough, so for the documentation we can safely assume the type of.linksto bedict[str, dict[str, str]].