Skip to content

Parse link headers (rfc5988) #2948

Closed
Closed
@daniel-j-h

Description

See psf/requests#711 for context.

It would be great if aiohttp could parse link headers helping e.g. with pagination.

At the moment the ClientResponse has a headers attribute from which we can get the link header:

print(response.headers.get('Link'))

<https://example.com//page/3>; rel="next", <https://example.com/page/1>; rel="prev"

But it's of type str and not parsed. To use the url e.g. in the next rel (for pagination) users currently have to parse the link header string manually pulling out the url.

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions