def _is_valid_api_url ( self , url ) : # Check response is a JSON with ok: 1 data = { } try : r = requests . get ( url , proxies = self . proxy_servers ) content = to_text_string ( r . content , encoding = 'utf-8' ) data = json . loads ( content ) except Exception as error : logger . error ( str ( error ) ) return data . get ( 'ok' , 0 ) == 1
python check api url data change
Callback for is_valid_api_url .
def _is_valid_api_url(self, url):
        """Callback for is_valid_api_url."""
        # Check response is a JSON with ok: 1
        data = {}
        try:
            r = requests.get(url, proxies=self.proxy_servers)
            content = to_text_string(r.content, encoding='utf-8')
            data = json.loads(content)
        except Exception as error:
            logger.error(str(error))

        return data.get('ok', 0) == 1