Skip to content

Commit

Permalink
Merge pull request #156 from influxdata/jdstrand/get-response-header-…
Browse files Browse the repository at this point in the history
…better

chore(net): use r.header.get("header") to robustify header handling
  • Loading branch information
jdstrand authored May 31, 2024
2 parents 83eb228 + c4ee44c commit dc1c40d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cvelib/net.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,9 @@ def ghAPIGetList(
return r.status_code, []

found_link: bool = False
if "Link" in r.headers:
tmp: List[str] = r.headers["Link"].split(",")
link_header: Union[str, None] = r.headers.get("Link")
if link_header is not None:
tmp: List[str] = link_header.split(",")
for i in tmp:
# '<https://.../alerts?per_page=100&after=Y3Vyc29yOnYyOpHO0RA03w%3D%3D>; rel="next"'
if '>; rel="next"' in i:
Expand Down

0 comments on commit dc1c40d

Please sign in to comment.