Quantcast
Channel: Configuration - Home Assistant Community
Viewing all articles
Browse latest Browse all 95919

Command line quote escaping

$
0
0

@jon_r wrote:

Hi

I’m trying to send a curl command via command line sensor, but it’s dropping the double quotes " around the URL and Authorization.

This is the command: -

command: 'curl -s "https://my.tado.com/api/v1/me" -H "Authorization: Bearer {{ state_attr(''sensor.tado_auth'', ''access_token'') }}" ' 

For clarity, these are double quotes “https… …me” “Authorization… … }}”
and these are two lots of single quotes ‘‘sensor.tado_auth’’, ‘‘access_token’’
and there is a single quote at the beginning and end.

I’ve tried doubling up the double quotes, just in case, but that didn’t work.

I have another call, surrounded by single quotes, and with the url in double quotes, that works perfectly, but it doesn’t need an Authorization token

The log shows: -

Command failed: curl -s https://my.tado.com/api/v1/me -H Authorization: Bearer eyJhbGciOZD7JfPdL1V4vY526ZY-UCGg

Whereas if I use a terminal, and manually add back in the quotes it works perfectly: -

curl -s "https://my.tado.com/api/v1/me" -H "Authorization: Bearer eyJhbGciOZD7JfPdL1V4vY526ZY-UCGg" 

(I’ve shortened the token significantly)

Thanks in advance for any help

Jonathan

Posts: 2

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 95919

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>