Skip to content

Add initial rest query params#42198

Merged
bdraco merged 12 commits intohome-assistant:devfrom
boxcee:rest-query-params
Nov 11, 2020
Merged

Add initial rest query params#42198
bdraco merged 12 commits intohome-assistant:devfrom
boxcee:rest-query-params

Conversation

@boxcee
Copy link
Copy Markdown
Contributor

@boxcee boxcee commented Oct 22, 2020

Breaking change

Proposed change

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)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Example entry for configuration.yaml:

sensor:
- platform: rest
  resource_template: 'https://revgeocode.search.hereapi.com/v1/revgeocode'
  params:
    at: '52.521,13.3807'
    lang: 'en-GB'
    apiKey: !secret apiKey
  value_template: '{{ value_json["items"][0]["address"]["district"] }}'

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.
  • Untested files have been added to .coveragerc.

The integration reached or maintains the following Integration Quality Scale:

  • No score or internal
  • 🥈 Silver
  • 🥇 Gold
  • 🏆 Platinum

@probot-home-assistant
Copy link
Copy Markdown

Hey there @fabaff, mind taking a look at this pull request as its been labeled with an integration (scrape) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@probot-home-assistant
Copy link
Copy Markdown

Hey there @fabaff, mind taking a look at this pull request as its been labeled with an integration (pvoutput) you are listed as a codeowner for? Thanks!
(message by CodeOwnersMention)

@MartinHjelmare MartinHjelmare changed the title add initial rest query params Add initial rest query params Oct 22, 2020
@boxcee boxcee mentioned this pull request Oct 22, 2020
20 tasks
Comment thread homeassistant/const.py
CONF_OFFSET = "offset"
CONF_OPTIMISTIC = "optimistic"
CONF_PACKAGES = "packages"
CONF_PARAMS = "params"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be parameters.

Suggested change
CONF_PARAMS = "params"
CONF_PARAMETERS = "parameters"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Naming is directly taken from httpx. requests uses the same naming.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@boxcee
Copy link
Copy Markdown
Contributor Author

boxcee commented Oct 26, 2020

@bdraco Added the link to the documentation PR in the description.

Copy link
Copy Markdown
Member

@bdraco bdraco left a comment

Choose a reason for hiding this comment

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

LGTM.

I'm going to defer merging in case fabaff feels strongly about the naming.

@boxcee
Copy link
Copy Markdown
Contributor Author

boxcee commented Nov 5, 2020

Hey @fabaff, can you double-check?

@boxcee
Copy link
Copy Markdown
Contributor Author

boxcee commented Nov 11, 2020

requests docs: https://requests.readthedocs.io/en/latest/api/#requests.Request
httpx docs: https://www.python-httpx.org/api/#client
treq docs: https://treq.readthedocs.io/en/release-20.9.0/api.html

The three above all use params.

Really looking forward to this feature. Right now I cannot use secrets in query parameters.

Please, take decision: @bdraco, @MartinHjelmare, @fabaff.

@bdraco
Copy link
Copy Markdown
Member

bdraco commented Nov 11, 2020

Please do not ping reviewers. There is a significant backlog of PRs to review, and working though additional notifications only slows things down.

@bdraco bdraco merged commit 434d39a into home-assistant:dev Nov 11, 2020
@boxcee boxcee deleted the rest-query-params branch November 11, 2020 19:04
KJonline pushed a commit to Pyhass/core that referenced this pull request Nov 11, 2020
* 'dev' of https://github.com/home-assistant/core: (552 commits)
  Use media player image proxy for roku media browser (home-assistant#43070)
  Add Shelly support for REST sensors (home-assistant#40429)
  Add system health section for the Supervisor (home-assistant#43074)
  Simplify distance conversion (home-assistant#43107)
  Add initial rest query params (home-assistant#42198)
  Bump pycsspeechtts to 1.0.4 (home-assistant#43105)
  Bump greeclimate to 0.9.6 (home-assistant#43106)
  Add reboot and shutdown service to synology_dsm (home-assistant#42697)
  Bump up ZHA dependencies (home-assistant#43104)
  Modify wait timeout in stream (home-assistant#42794)
  Bumped version to 0.117.6
  Fix Plex auth issues by setting header (home-assistant#43081)
  Bump gTTS-token to 1.1.4 (home-assistant#43015)
  Bump pwmled to v1.6.7 (home-assistant#42903)
  Remove unneeded state restoration of the physical device in rpi_gpio_pwm integration (home-assistant#42804)
  Update frontend to 20201111.0 (home-assistant#43101)
  Show media progress in sisyphus (home-assistant#42996)
  Use internal url for Squeezebox if possible (home-assistant#43089)
  Add watchdog to reset nest subscriber (home-assistant#43034)
  Bump hatasmota to 0.0.29 (home-assistant#43013)
  ...
rccoleman pushed a commit to rccoleman/core that referenced this pull request Dec 4, 2020
* add initial rest query params

* of course I didn't run black

* fix tests

* fix tests

* add test

* reformat

* add binary sensor test

* fix tests

* add one more test and fix switch

* should not have touched that

* if you don't pay attention once
rccoleman pushed a commit to rccoleman/core that referenced this pull request Dec 4, 2020
* add initial rest query params

* of course I didn't run black

* fix tests

* fix tests

* add test

* reformat

* add binary sensor test

* fix tests

* add one more test and fix switch

* should not have touched that

* if you don't pay attention once
Thomas55555 pushed a commit to Thomas55555/core that referenced this pull request Feb 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants