def __init__(self, url_results):
self.curls = {}
for url in url_results:
result = url_results[url]
if not isinstance(result, tuple):
body = result
http_code = 200
else:
body = result[0]
http_code = result[1]
self.curls[url] = CurlStub(
result=body, infos={pycurl.HTTP_CODE: http_code})
# Use thread local storage to keep the current CurlStub since
# CurlManyStub is passed to multiple threads, but the state needs to be
# local.
self._local = local()
self._local.current = None
评论列表
文章目录