Skip to content
This repository was archived by the owner on Jun 4, 2021. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions transport/transport_pool_.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,22 @@
"""A threadsafe pool of httplib2.Http handlers."""



import os
import threading

import httplib2


class Http(httplib2.Http):
"""A threadsafe pool of httplib2.Http transports."""

UNIX_CERT = "/etc/ssl/certs/ca-certificates.crt"
system_ca_cert = Http.UNIX_CERT if os.path.exists(Http.UNIX_CERT) else None
def __init__(self,
transport_factory,
size=2):
# Use system certs if possible
if Http.system_ca_cert:
httplib2.Http.__init__(self, ca_certs=Http.system_ca_cert)
self._condition = threading.Condition(threading.Lock())
self._transports = [transport_factory() for _ in xrange(size)]

Expand Down