You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"""Load data from URL, exported to const to call it from sensor and from config_flow."""
236
236
if(url.lower().startswith("file://")):
237
237
req=Request(url=url, data=None, headers={'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'})
@@ -240,10 +240,4 @@ def load_data(url):
240
240
241
241
asyncdefasync_load_data(hass, url):
242
242
"""Load data from URL, exported to const to call it from sensor and from config_flow."""
243
-
if(url.lower().startswith("file://")):
244
-
req=Request(url=url, data=None, headers={'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'})
245
-
ret=urlopen(req)
246
-
ret=awaithass.async_add_executor_job(ret.read)
247
-
returnret.decode('ISO-8859-1')
248
-
ret=awaithass.async_add_executor_job(partial(requests.get, url, headers={'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36'}, allow_redirects=True))
0 commit comments