mirror of
https://github.com/home-assistant/core.git
synced 2025-07-14 16:57:10 +00:00
Fix haveibeenpwned user-agent string (#84919)
* Fixed user-agent string not being accepted as an valid header * Update homeassistant/components/haveibeenpwned/sensor.py Co-authored-by: Martin Hjelmare <marhje52@gmail.com> * Removed the aiohttp import Co-authored-by: Martin Hjelmare <marhje52@gmail.com>
This commit is contained in:
parent
5c7120aa36
commit
a168df342d
@ -5,7 +5,6 @@ from datetime import timedelta
|
|||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from aiohttp.hdrs import USER_AGENT
|
|
||||||
import requests
|
import requests
|
||||||
import voluptuous as vol
|
import voluptuous as vol
|
||||||
|
|
||||||
@ -160,7 +159,7 @@ class HaveIBeenPwnedData:
|
|||||||
"""Get the latest data for current email from REST service."""
|
"""Get the latest data for current email from REST service."""
|
||||||
try:
|
try:
|
||||||
url = f"{URL}{self._email}?truncateResponse=false"
|
url = f"{URL}{self._email}?truncateResponse=false"
|
||||||
header = {USER_AGENT: HA_USER_AGENT, "hibp-api-key": self._api_key}
|
header = {"User-Agent": HA_USER_AGENT, "hibp-api-key": self._api_key}
|
||||||
_LOGGER.debug("Checking for breaches for email: %s", self._email)
|
_LOGGER.debug("Checking for breaches for email: %s", self._email)
|
||||||
req = requests.get(url, headers=header, allow_redirects=True, timeout=5)
|
req = requests.get(url, headers=header, allow_redirects=True, timeout=5)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user