Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix haveibeenpwned user-agent string #84919

Merged
merged 4 commits into from
Jan 1, 2023
Merged

Fix haveibeenpwned user-agent string #84919

merged 4 commits into from
Jan 1, 2023

Conversation

ChopperRob
Copy link
Contributor

Breaking change

Proposed change

The HaveIBeenComponent was broken because the requests library does no longer allow an istr in a header, only a str.
The user-agent header is now first converted to a str which fixes the issue

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • The code has been formatted using Black (black --fast homeassistant tests)
  • Tests have been added to verify that the new code works.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies - a link to the changelog, or at minimum a diff between library versions is added to the PR description.
  • Untested files have been added to .coveragerc.

To help with the load of incoming pull requests:

@MartinHjelmare MartinHjelmare changed the title Fixed user-agent string not being accepted as an valid header Fix haveibeenpwned user-agent string Dec 31, 2022
@MartinHjelmare MartinHjelmare added this to the 2023.1.0 milestone Dec 31, 2022
@MartinHjelmare
Copy link
Member

MartinHjelmare commented Dec 31, 2022

Note that this integration still needs a 3rd party library for the interface code to the service, but we're going to accept this small fix. Larger changes will need a 3rd party library first.

@ChopperRob
Copy link
Contributor Author

I updated the branch as suggested.

Copy link
Contributor

@jmwhite5 jmwhite5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change makes sense. Previously, it was mixing 2 different HTTP client libraries (aiohttp and requests). This change standardizes on "requests"

Copy link
Member

@MartinHjelmare MartinHjelmare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MartinHjelmare MartinHjelmare merged commit 208b281 into home-assistant:dev Jan 1, 2023
khoih-prog pushed a commit to khoih-prog/HomeAssistant_core that referenced this pull request Jan 1, 2023
* 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>
@ChopperRob ChopperRob deleted the HIBP_Fix branch January 1, 2023 19:30
balloob pushed a commit that referenced this pull request Jan 2, 2023
* 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>
@github-actions github-actions bot locked and limited conversation to collaborators Jan 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2022.7 haveibeenpwned integration stopped working
4 participants