Skip to content

Commit

Permalink
fix: httpauth issue
Browse files Browse the repository at this point in the history
  • Loading branch information
akrherz committed Nov 19, 2023
1 parent e249fa7 commit e1cc5fd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions htdocs/current/live.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from pyiem.util import get_dbconn, get_properties
from pyiem.webutil import iemapp
from pymemcache.client import Client
from requests.auth import HTTPDigestAuth
from requests.auth import HTTPBasicAuth, HTTPDigestAuth


def fetch(cid):
Expand Down Expand Up @@ -49,7 +49,15 @@ def fetch(cid):
if is_vapix:
uribase = "http://%s:%s/axis-cgi/jpg/image.cgi"
uri = uribase % (ip if ip is not None else fqdn, port)
req = requests.get(uri, auth=HTTPDigestAuth(user, passwd), timeout=15)
ham = (
HTTPBasicAuth
if cid
in [
"KCRG-010",
]
else HTTPDigestAuth
)
req = requests.get(uri, auth=ham(user, passwd), timeout=15)
if req.status_code != 200:
return None
image = Image.open(BytesIO(req.content))
Expand Down

0 comments on commit e1cc5fd

Please sign in to comment.