コード例 #1
0
    def _trigger_remote_service(self, service_id: _Services, post=False) -> requests.Response:
        """Trigger a generic remote service.

        You can choose if you want a POST or a GET operation.
        """
        data = {'serviceType': service_id.value}
        url = REMOTE_SERVICE_URL.format(vin=self._vehicle.vin, server=self._account.server_url)

        return self._account.send_request(url, post=post, data=data)
コード例 #2
0
    def _trigger_remote_service(self,
                                service_id: _Services,
                                action=None,
                                post=True) -> str:
        """Trigger a generic remote service.

        You can choose if you want a POST or a GET operation.
        """
        url = REMOTE_SERVICE_URL.format(
            server=self._account.server_url,
            vin=self._vehicle.vin,
            service_type=service_id.value.lower().replace('_', '-'))
        params = {"action": action}
        response = self._account.send_request(url,
                                              post=post,
                                              params=params,
                                              brand=self._vehicle.brand)
        try:
            return response.json().get('eventId')
        except JSONDecodeError:
            return None