Permalink
Browse files

clean up a bit

  • Loading branch information...
1 parent 720abf9 commit 1a35a228feef66c98102f6cac88016fc29257123 @jamesturk committed Apr 18, 2012
Showing with 3 additions and 6 deletions.
  1. +0 −2 scrapelib.py
  2. +3 −4 test.py
View
@@ -201,7 +201,6 @@ def from_httplib2_response(self, url, resp):
headers=resp)
-
class MongoCache(object):
"""
Implements the httplib2 cache protocol using MongoDB
@@ -579,7 +578,6 @@ def urlopen(self, url, method='GET', body=None, retry_on_404=False,
# return our_resp wrapped in content
return self._wrap_result(our_resp, content)
-
def urlretrieve(self, url, filename=None, method='GET', body=None):
"""
Save result of a request to a file, similarly to
View
@@ -3,7 +3,6 @@
import glob
import time
import socket
-import urllib2
import tempfile
from multiprocessing import Process
@@ -25,6 +24,7 @@
app.config.shaky_fail = False
app.config.shaky_404_fail = False
+
@app.route('/')
def index():
resp = app.make_response("Hello world!")
@@ -72,6 +72,7 @@ def shaky():
else:
return "shaky success!"
+
@app.route('/shaky404')
def shaky404():
# toggle failure state each time
@@ -82,6 +83,7 @@ def shaky404():
else:
return "shaky404 success!"
+
def run_server():
class NullFile(object):
def write(self, s):
@@ -261,7 +263,6 @@ def test_urlretrieve(self):
self.assertEqual(200, resp.code)
os.remove(set_fname)
-
# TODO: on these retry tests it'd be nice to ensure that it tries
# 3 times for 500 and once for 404
@@ -273,13 +274,11 @@ def test_retry_httplib2(self):
'GET', None, {})
self.assertEqual(content, 'shaky success!')
-
# 500 always
resp, content = s._do_request('http://localhost:5000/500',
'GET', None, {})
self.assertEqual(resp.code, 500)
-
def test_retry_httplib2_404(self):
s = scrapelib.Scraper(retry_attempts=3, retry_wait_seconds=0.1)

0 comments on commit 1a35a22

Please sign in to comment.