palazzem / econnect-python

API adapter used to control programmatically an Elmo alarm system
BSD 3-Clause "New" or "Revised" License
8 stars 5 forks source link

Introduce a safer API so that only HTTPS urls can be used #63

Closed palazzem closed 3 years ago

palazzem commented 3 years ago

Overview

Closes #58

By design, the client must not accept any URL that is not encrypted (HTTPS). If a non-HTTPS url is used, a ValidationError is raised to the main application.

There is no way to bypass this, so in case you really need an http endpoint, feel free to open a new issue so we can discuss the requirement there. The main reason why I prefer this approach, is because such credentials are really sensitive (they control your home alarm system) and so I'd prefer to prevent any possible typo/unwanted mistake.

Usage

ElmoClient(base_url="http://example.com")     # Raises ValidationError exception
ElmoClient(base_url="https://example.com")    # Is accepted
codecov-io commented 3 years ago

Codecov Report

Merging #63 (ad43c2d) into master (e1b1629) will not change coverage. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #63   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            5         5           
  Lines          168       176    +8     
=========================================
+ Hits           168       176    +8     
Impacted Files Coverage Δ
elmo/api/exceptions.py 100.00% <100.00%> (ø)
elmo/api/router.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update e1b1629...ad43c2d. Read the comment docs.