mirror of
https://github.com/home-assistant/core.git
synced 2025-07-24 21:57:51 +00:00
Fix scrape sensor auth with httpx (#49806)
This commit is contained in:
parent
dcb5b9f8b5
commit
14869483ca
@ -2,7 +2,7 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
from bs4 import BeautifulSoup
|
from bs4 import BeautifulSoup
|
||||||
from requests.auth import HTTPBasicAuth, HTTPDigestAuth
|
import httpx
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
from homeassistant.components.rest.data import RestData
|
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 username and password:
|
||||||
if config.get(CONF_AUTHENTICATION) == HTTP_DIGEST_AUTHENTICATION:
|
if config.get(CONF_AUTHENTICATION) == HTTP_DIGEST_AUTHENTICATION:
|
||||||
auth = HTTPDigestAuth(username, password)
|
auth = httpx.DigestAuth(username, password)
|
||||||
else:
|
else:
|
||||||
auth = HTTPBasicAuth(username, password)
|
auth = (username, password)
|
||||||
else:
|
else:
|
||||||
auth = None
|
auth = None
|
||||||
rest = RestData(hass, method, resource, auth, headers, None, payload, verify_ssl)
|
rest = RestData(hass, method, resource, auth, headers, None, payload, verify_ssl)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user