From a35c54525d11b2b551c1258ac060e8b1bf1aadf5 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Mon, 11 Feb 2013 19:52:59 +0100 Subject: [PATCH] Work around a bug in python requests. --- dosagelib/util.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/dosagelib/util.py b/dosagelib/util.py index 891061ba2..6faaf64e5 100644 --- a/dosagelib/util.py +++ b/dosagelib/util.py @@ -101,6 +101,10 @@ def getPageContent(url, max_content_bytes=MaxContentBytes, session=None): # read page data page = urlopen(url, max_content_bytes=max_content_bytes, session=session) data = page.text + if not data: + # sometimes the python requests library is wonky - try again + page = urlopen(url, max_content_bytes=max_content_bytes, session=session) + data = page.text # determine base URL baseUrl = None match = baseSearch.search(data)