Skip to content
This repository has been archived by the owner on Jun 20, 2024. It is now read-only.

Commit

Permalink
replace requests with httpx, update deps
Browse files Browse the repository at this point in the history
also remove some code related to SSL cert errors on our Koha which no longer happen
  • Loading branch information
phette23 committed Jun 12, 2023
1 parent 58ac481 commit abb30b4
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 117 deletions.
9 changes: 3 additions & 6 deletions linkcheck.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import csv
import io
import logging
import urllib3

import requests
import httpx

import config

Expand All @@ -26,9 +25,7 @@ def quote(list):
writer.writerow(list)
return output.getvalue().strip()

# our Koha cert isn't recognized but it's fine, silence this warning
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
report = requests.get(config.report_url, verify=False)
report = httpx.get(config.report_url)
sums = { "exception": 0 }

for bib in report.json():
Expand All @@ -38,7 +35,7 @@ def quote(list):
urls = urls.split(' | ')
for url in urls:
try:
r = requests.get(url)
r = httpx.get(url)
status = r.status_code
if not sums.get(status): sums[status] = 0
sums[status] += 1
Expand Down
182 changes: 73 additions & 109 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ authors = ["Eric Phetteplace <[email protected]>"]
license = "ECL-2.0"

[tool.poetry.dependencies]
python = "^3.9"
requests = "^2.31.0"
python = "^3.11"
httpx = "^0.24.1"

[tool.poetry.dev-dependencies]

Expand Down

0 comments on commit abb30b4

Please sign in to comment.