[mod] remove image proxy requests from the connection pool

This commit is contained in:
Adam Tauber 2015-04-10 01:10:49 +02:00
parent 9d11b36b5b
commit b2e026dde2

View file

@ -26,6 +26,7 @@ import json
import cStringIO import cStringIO
import os import os
import hashlib import hashlib
import requests
from searx import logger from searx import logger
logger = logger.getChild('webapp') logger = logger.getChild('webapp')
@ -48,7 +49,6 @@ from flask import (
) )
from flask.ext.babel import Babel, gettext, format_date from flask.ext.babel import Babel, gettext, format_date
from searx import settings, searx_dir from searx import settings, searx_dir
from searx.poolrequests import get as http_get
from searx.engines import ( from searx.engines import (
categories, engines, get_engines_stats, engine_shortcuts categories, engines, get_engines_stats, engine_shortcuts
) )
@ -632,10 +632,10 @@ def image_proxy():
headers = dict_subset(request.headers, {'If-Modified-Since', 'If-None-Match'}) headers = dict_subset(request.headers, {'If-Modified-Since', 'If-None-Match'})
headers['User-Agent'] = gen_useragent() headers['User-Agent'] = gen_useragent()
resp = http_get(url, resp = requests.get(url,
stream=True, stream=True,
timeout=settings['server'].get('request_timeout', 2), timeout=settings['server'].get('request_timeout', 2),
headers=headers) headers=headers)
if resp.status_code == 304: if resp.status_code == 304:
return '', resp.status_code return '', resp.status_code