(
        self,
        url=None,
        data=None,
        headers=None,
        reqtype="get",
        stream=False,
        json_resp=True,
        is_retry=False,
        timeout=TIMEOUT,
    )
return None
Perform server requests.

        :param url: URL to perform request
        :param data: Data to send
        :param headers: Headers to send
        :param reqtype: Can be 'get' or 'post' (default: 'get')
        :param stream: Stream response? True/FALSE
        :param json_resp: Return JSON response? TRUE/False
        :param is_retry: Is this part of a re-auth attempt? True/FALSE
Perform server requests.
Perform server requests .
def query(
        self,
        url=None,
        data=None,
        headers=None,
        reqtype="get",
        stream=False,
        json_resp=True,
        is_retry=False,
        timeout=TIMEOUT,
    ):
        """
        Perform server requests.

        :param url: URL to perform request
        :param data: Data to send
        :param headers: Headers to send
        :param reqtype: Can be 'get' or 'post' (default: 'get')
        :param stream: Stream response? True/FALSE
        :param json_resp: Return JSON response? TRUE/False
        :param is_retry: Is this part of a re-auth attempt? True/FALSE
        """
        req = self.prepare_request(url, headers, data, reqtype)
        try:
            response = self.session.send(req, stream=stream, timeout=timeout)
            return self.validate_response(response, json_resp)
        except (exceptions.ConnectionError, exceptions.Timeout):
            _LOGGER.error(
                "Connection error. Endpoint %s possibly down or throttled.", url,
            )
        except BlinkBadResponse:
            code = None
            reason = None
            try:
                code = response.status_code
                reason = response.reason
            except AttributeError:
                pass
            _LOGGER.error(
                "Expected json response from %s, but received: %s: %s",
                url,
                code,
                reason,
            )
        except UnauthorizedError:
            try:
                if not is_retry:
                    self.refresh_token()
                    return self.query(
                        url=url,
                        data=data,
                        headers=self.header,
                        reqtype=reqtype,
                        stream=stream,
                        json_resp=json_resp,
                        is_retry=True,
                        timeout=timeout,
                    )
                _LOGGER.error("Unable to access %s after token refresh.", url)
            except TokenRefreshFailed:
                _LOGGER.error("Unable to refresh token.")
        return None
def query ( self , url = None , data = None , headers = None , reqtype = "get" , stream = False , json_resp = True , is_retry = False , timeout = TIMEOUT , ) : req = self . prepare_request ( url , headers , data , reqtype ) try : response = self . session . send ( req , stream = stream , timeout = timeout ) return self . validate_response ( response , json_resp ) except ( exceptions . ConnectionError , exceptions . Timeout ) : _LOGGER . error ( "Connection error. Endpoint %s possibly down or throttled." , url , ) except BlinkBadResponse : code = None reason = None try : code = response . status_code reason = response . reason except AttributeError : pass _LOGGER . error ( "Expected json response from %s, but received: %s: %s" , url , code , reason , ) except UnauthorizedError : try : if not is_retry : self . refresh_token ( ) return self . query ( url = url , data = data , headers = self . header , reqtype = reqtype , stream = stream , json_resp = json_resp , is_retry = True , timeout = timeout , ) _LOGGER . error ( "Unable to access %s after token refresh." , url ) except TokenRefreshFailed : _LOGGER . error ( "Unable to refresh token." ) return None