Skip to main content

Library for parsing RFC 8288 "Link" HTTP headers

Project description

Python (>= 3.6) library for parsing RFC 8288 HTTP Link headers. Python 2 is not supported.

from httplink import parse_link_header
result = parse_link_header('''
   <>; rel=index;
   foo*=UTF-8'en'b%c3%a5r, </path#frag>;rel="what ever"

## Target URL:

## Set of link relations:
# {'index'}

## Decoded attribute value:
# bår

## Raw undecoded attributes:
# [('rel', 'index'), ('foo*', "UTF-8'en'b%c3%a5r")]

## Iterate over all links:
for link in result.links:
# {'index'}
# {'ever', 'what'} /path#frag

Multiple Link headers can be parsed at the same time if you concatenate them with ,.

Redundant white space and comma delimiters are ignored.

["key"]-access is always case-insensitive.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for httplink, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size httplink-0.2.0-py3-none-any.whl (5.3 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page