1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-12 16:22:22 +01:00

http_request component (#719)

* It works

* Template doesn't work

* Template fix

* CA Certificate untested

* ESP32 done

* URL validation

* Lint fix

* Lint fix (2)

* Lint fix (<3)

* Support unsecure requests with framework >=2.5.0

* Removed fingerprint, payload renamed to body

* Removed add_extra

* Review

* Review

* New HTTP methods

* Check recommended version

* Removed dead code

* Small improvement

* Small improvement

* CONF_METHOD from const

* JSON support

* New JSON syntax

* Templatable headers

* verify_ssl param

* verify_ssl param (fix)

* Lint

* nolint

* JSON string_strict

* Two json syntax

* Lambda url fix validation

* CI fix

* CI fix
This commit is contained in:
Nikolay Vasilchuk
2019-11-09 20:37:52 +03:00
committed by Otto Winter
parent 3e8fd48dc0
commit f8d98ac494
6 changed files with 341 additions and 5 deletions

View File

@@ -7,13 +7,17 @@ from esphome.util import Registry
def maybe_simple_id(*validators):
return maybe_conf(CONF_ID, *validators)
def maybe_conf(conf, *validators):
validator = cv.All(*validators)
def validate(value):
if isinstance(value, dict):
return validator(value)
with cv.remove_prepend_path([CONF_ID]):
return validator({CONF_ID: value})
with cv.remove_prepend_path([conf]):
return validator({conf: value})
return validate