示例#1
0
 def createConnectionPool(self, url):
     """create the connection pool -> to facilitate socket reuse"""
     timeout = self.callback.onlineRequestTimeout
     #headers = { 'User-Agent' : "Mozilla/5.0 (compatible; MSIE 5.5; Linux)" }
     userAgent = self.callback.modrana.configs.getUserAgent()
     headers = {'User-Agent': userAgent}
     connPool = urllib3.connection_from_url(url, headers=headers, timeout=timeout, maxsize=self.maxThreads,
                                            block=False)
     return connPool
示例#2
0
 def _getConnPool(self, layer, url):
   """
   get a connection pool for the given layer
   NOTE: connection pools reuse open connections
   """
   pool = self.connPools.get(layer, None)
   if pool:
     return pool
   else: # create pool
     #headers = { 'User-Agent' : "Mozilla/5.0 (compatible; MSIE 5.5; Linux)" }
     userAgent = self.modrana.configs.getUserAgent()
     headers = {'User-Agent': userAgent}
     url = self.mapLayers.get(layer)["tiles"]
     newPool = urllib3.connection_from_url(url=url, headers=headers, maxsize=10, timeout=10, block=False)
     self.connPools[layer] = newPool
     return newPool
示例#3
0
 def createConnectionPool(self, url):
     """create the connection pool -> to facilitate socket reuse"""
     timeout = self.callback.onlineRequestTimeout
     connPool = urllib3.connection_from_url(url, timeout=timeout, maxsize=self.maxThreads, block=False)
     return connPool