Python module that extracts links and their relations from a Link Header Field and returns them in a dict.
Project description
This Python module contains only one function: extract.
It extracts links and their relations from a Link Header Field [1] and returns a dict where the keys are the relations and the values are the links themselves.
Installation
pip install links-from-link-header
Usage
>>> import links_from_header >>> header = '<https://api.github.com/user/repos?page=1>; rel="first", <https://api.github.com/user/repos?page=9>; rel="prev", <https://api.github.com/user/repos?page=11>; rel="next", <https://api.github.com/user/repos?page=50>; rel="last"' >>> links_from_header.extract(header) { 'first': 'https://api.github.com/user/repos?page=1', 'prev': 'https://api.github.com/user/repos?page=9', 'next': 'https://api.github.com/user/repos?page=11', 'last': 'https://api.github.com/user/repos?page=50', }
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for links-from-link-header-0.1.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | e0c1b5a34cee90dee55fa77c016d12144b116525527c790243d196281db9a25b |
|
MD5 | 0c505874b782780f72409ce74e8fef47 |
|
BLAKE2b-256 | f1824a877f68045d7e503e60d021da6fefb18bd3be973ba44ff7edec4dc778ce |