INNER CODE UNIT · Python

_load_response

siznax/wptools · wptools/core.py:185

    def _load_response(self, action):
        """
        returns API reponse from cache or raises ValueError
        """
        _query = self.cache[action]['query'].replace('&format=json', '')
        response = self.cache[action]['response']

        if not response:
            raise ValueError("Empty response: %s" % self.params)

        data = response

        if data.get('warnings'):
            if 'WARNINGS' in self.data:
                self.data['WARNINGS'].update(data['warnings'])
            else:
                self.data['WARNINGS'] = data['warnings']

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…