@pytest.fixture()
def link_headers(manager):
 def headers(response):
  links = {}
  for link in requests.utils.parse_header_links(response.headers.get(u'link')):
   url = link[u'url']
   page = int(re.search(u'(?<!per_)page=(\\d)', url).group(1))
   links[link[u'rel']] = dict(url=url, page=page)
  return links
 return headers

@ pytest . fixture ( ) def link_headers ( manager ) : def headers ( response ) : links = { } for link in requests . utils . parse_header_links ( response . headers . get ( u'link' ) ) : url = link [ u'url' ] page = int ( re . search ( u'(?<!per_)page=(\\d)' , url ) . group ( 1 ) ) links [ link [ u'rel' ] ] = dict ( url = url , page = page ) return links return headers
parses link headers and return them in dict form .