aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2014-07-13 17:34:19 +0200
committerCédric Bonhomme <cedric@cedricbonhomme.org>2014-07-13 17:34:19 +0200
commit0f13491e86cc0a52c974baccea4fca176d7d1a69 (patch)
treedfc6495ba71a475d6f023594554c63910ab01395
parentIt is useless to retrieve all articles in order to count the number of articles. (diff)
downloadnewspipe-0f13491e86cc0a52c974baccea4fca176d7d1a69.tar.gz
newspipe-0f13491e86cc0a52c974baccea4fca176d7d1a69.tar.bz2
newspipe-0f13491e86cc0a52c974baccea4fca176d7d1a69.zip
Timeout of 5 seconds for all sockets.
-rw-r--r--pyaggr3g470r/crawler.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/pyaggr3g470r/crawler.py b/pyaggr3g470r/crawler.py
index af0597a1..48ee22d2 100644
--- a/pyaggr3g470r/crawler.py
+++ b/pyaggr3g470r/crawler.py
@@ -27,6 +27,7 @@ __copyright__ = "Copyright (c) Cedric Bonhomme"
__license__ = "AGPLv3"
import re
+import socket
import logging
import feedparser
import urllib2
@@ -35,7 +36,7 @@ import dateutil.parser
from bs4 import BeautifulSoup
from datetime import datetime
from sqlalchemy.exc import IntegrityError
-#from requests.exceptions import *
+from requests.exceptions import *
import gevent.monkey
gevent.monkey.patch_all()
@@ -53,6 +54,7 @@ if not conf.ON_HEROKU:
logger = logging.getLogger(__name__)
+socket.setdefaulttimeout(5.0)
class TooLong(Exception):
def __init__(self):
bgstack15