예제 #1
0
def get_cacerts_bundle():
  """Returns path to a file with CA root certificates bundle."""
  global _ca_certs
  with _ca_certs_lock:
    if _ca_certs is not None and os.path.exists(_ca_certs):
      return _ca_certs
    _ca_certs = zip_package.extract_resource(requests, 'cacert.pem')
    return _ca_certs
예제 #2
0
def get_cacerts_bundle():
    """Returns path to a file with CA root certificates bundle."""
    global _ca_certs
    with _ca_certs_lock:
        if _ca_certs is not None and os.path.exists(_ca_certs):
            return _ca_certs
        _ca_certs = zip_package.extract_resource(requests, 'cacert.pem')
        return _ca_certs
예제 #3
0
파일: tools.py 프로젝트: nodirt/luci-py
def get_cacerts_bundle():
  """Returns path to a file with CA root certificates bundle.

  Python's ssl module needs a real file on disk, so if code is running from
  a zip archive, we need to extract the file first.
  """
  global _ca_certs
  with _ca_certs_lock:
    if _ca_certs is not None and os.path.exists(_ca_certs):
      return _ca_certs
    # Some rogue process clears /tmp and causes cacert.pem to disappear. Extract
    # to current directory instead. We use our own bundled copy of cacert.pem.
    _ca_certs = zip_package.extract_resource(utils, 'cacert.pem', temp_dir='.')
    return _ca_certs
예제 #4
0
def get_cacerts_bundle():
  """Returns path to a file with CA root certificates bundle.

  Python's ssl module needs a real file on disk, so if code is running from
  a zip archive, we need to extract the file first.
  """
  global _ca_certs
  with _ca_certs_lock:
    if _ca_certs is not None and os.path.exists(_ca_certs):
      return _ca_certs
    # Some rogue process clears /tmp and causes cacert.pem to disappear. Extract
    # to current directory instead. We use our own bundled copy of cacert.pem.
    _ca_certs = zip_package.extract_resource(utils, 'cacert.pem', temp_dir='.')
    return _ca_certs