home.py 文件源码

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

项目:aerospike-telemetry-agent 作者: aerospike 项目源码 文件源码
def postInfo(self, requestParams):
        logging.info("About to phone home to [%s].", self.url)

        req = urllib2.Request(self.url)
        req.add_header('Content-Type', 'application/json')
        resp = None

        try:
            resp = urllib2.urlopen(req, json.dumps(requestParams), timeout = 30, **self.kwargs)
            resp = resp.read()
        except urllib2.HTTPError, e:
            logging.error("HTTPError: %s", str(e.code))
        except urllib2.URLError, e:
            logging.error("URLError: %s", str(e.reason))
        except httplib.HTTPException, e:
            logging.error("HTTPException: %s", str(e))
        except Exception, e:
            logging.exception("Unexpected error: %s", str(e))

        return resp
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号