SSH command, fighting with the quotes

Hello
I’m trying to check a website json result on a regular basis to get a notification when it changes. I already have a switch that works like that:

- platform: command_line
    switches:
      allow_person1:
        command_on: "ssh -i /config/ssh/id_rsa -o UserKnownHostsFile=/config/ssh/known_hosts [email protected] 'python3 /opt/adguard_control/adg_clients.py person1 off'"
        command_off: "ssh -i /config/ssh/id_rsa -o UserKnownHostsFile=/config/ssh/known_hosts [email protected] 'python3 /opt/adguard_control/adg_clients.py person1 on'"
        command_state: "ssh -i /config/ssh/id_rsa -o UserKnownHostsFile=/config/ssh/known_hosts [email protected] 'python3 /opt/adguard_control/adg_clients.py person1 state'"
        value_template: '{{ value == "False" }}'

But this one is not:

- platform: command_line
    name: webpage_monitor
    command: ssh -i /config/ssh/id_rsa -o UserKnownHostsFile=/config/ssh/known_hosts [email protected] 'python3 -c "import requests; response = requests.head('https://api.github.com/users/mralexgray/repos'); print(response.headers.get('ETag'))"'
    scan_interval: 3600

First, I checked the python command on my remote PC and it works.
The only difference I can see between the two is the command between double quotes… I tried everything I could think of, but I’m getting the same error over and over.
Does anybody have an idea? Thanks in advance