session.py 文件源码

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

项目:os-xenapi 作者: openstack 项目源码 文件源码
def http_connection(self):
        conn = None

        xs_url = urllib.parse.urlparse(self.url)
        LOG.debug("Creating http(s) connection to %s", self.url)
        if xs_url.scheme == 'http':
            conn = http_client.HTTPConnection(xs_url.netloc)
        elif xs_url.scheme == 'https':
            conn = http_client.HTTPSConnection(xs_url.netloc)

        conn.connect()
        try:
            yield conn
        finally:
            conn.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号