Fix scrape sensor auth with httpx (#49806)

This commit is contained in:
J. Nick Koston 2021-04-27 23:24:11 -10:00 committed by GitHub
parent dcb5b9f8b5
commit 14869483ca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2,7 +2,7 @@
import logging
from bs4 import BeautifulSoup
from requests.auth import HTTPBasicAuth, HTTPDigestAuth
import httpx
import voluptuous as vol
from homeassistant.components.rest.data import RestData
@ -72,9 +72,9 @@ async def async_setup_platform(hass, config, async_add_entities, discovery_info=
if username and password:
if config.get(CONF_AUTHENTICATION) == HTTP_DIGEST_AUTHENTICATION:
auth = HTTPDigestAuth(username, password)
auth = httpx.DigestAuth(username, password)
else:
auth = HTTPBasicAuth(username, password)
auth = (username, password)
else:
auth = None
rest = RestData(hass, method, resource, auth, headers, None, payload, verify_ssl)