patched_.py 文件源码

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

项目:containerregistry 作者: google 项目源码 文件源码
def _monkey_patch_httplib2(extract_dir):
  """Patch things so that httplib2 works properly in a PAR.

  Manually extract certificates to file to make OpenSSL happy and avoid error:
     ssl.SSLError: [Errno 185090050] _ssl.c:344: error:0B084002:x509 ...

  Args:
    extract_dir: the directory into which we extract the necessary files.
  """
  if os.path.isfile(httplib2.CA_CERTS):
    # Not inside of a PAR file, so don't bother.
    return
  cacerts_contents = pkgutil.get_data('httplib2', 'cacerts.txt')
  cacerts_filename = os.path.join(extract_dir, 'cacerts.txt')
  with open(cacerts_filename, 'wb') as f:
    f.write(cacerts_contents)
  httplib2.CA_CERTS = cacerts_filename
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号