qnap_stats.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:python-qnapstats 作者: colinodell 项目源码 文件源码
def _handle_response(self, resp, force_list=None):
        """Ensure response is successful and return body as XML."""
        self._debuglog("Request executed: " + str(resp.status_code))
        if resp.status_code != 200:
            return None

        if resp.headers["Content-Type"] != "text/xml":
            # JSON requests not currently supported
            return None
        self._debuglog("Response Text: " + resp.text)
        data = xmltodict.parse(resp.content, force_list=force_list)['QDocRoot']

        auth_passed = data['authPassed']
        if auth_passed is not None and len(auth_passed) == 1 and auth_passed == "0":
            self._session_error = True
            return None

        return data
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号