Scrape Sensor - scrape data behind login


is it possible to provide website login data for this component so that you can scrape data which is behind a login?

Could it be, that I just have to edit:

to include the following in the PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({ section:

    vol.Optional(CONF_USERNAME): cv.string,
    vol.Optional(CONF_PASSWORD): cv.string,

and add the following to: def setup_platform(hass, config, add_devices, discovery_info=None):

username = config.get(CONF_USERNAME)
password = config.get(CONF_PASSWORD)

And finally then further down remove the “auth” from:

payload = auth = headers = None


payload = headers = None

It would be great if you could confirm these steps or help me along my way! Thanks!

Would be nice if you could check/test it. Thanks.

Well thank you for encouraging me! Mind you I am not a dev! Thanks to home assistant I created my first PR.

I closed your Pull Request because it’s a duplicate of the linked one.

I am sorry, I didn’t mean to cause any confusion. Somehow I overlooked your link. Anyway It was a very nice exercise for me. Cheers.

It’s very unfortunate that we did the same things. You were on the right track with your contribution. Please don’t let this little incident affect any future contribution.

1 Like