Skip to content
Browse files

swap session request and __call__ behaviour

  • Loading branch information...
1 parent 7d15bc0 commit a7e6ebfd046cc3d7cf97e8946f69cc68b9eb77b8 @baverman committed Mar 24, 2013
Showing with 5 additions and 5 deletions.
  1. +1 −1 swoop/request.py
  2. +2 −2 swoop/session.py
  3. +2 −2 tests/test_swoop.py
View
2 swoop/request.py
@@ -74,7 +74,7 @@ def fetch(self):
assert self.session_ref
session = self.session_ref()
assert session
- return session.request(self)
+ return session(self)
def post_multipart(host, selector, fields, files):
"""
View
4 swoop/session.py
@@ -56,7 +56,7 @@ def _get_default_headers(self):
'Connection': 'Keep-Alive'
}
- def request(self, request):
+ def __call__(self, request):
if isinstance(request, basestring):
request = Request(request)
@@ -82,7 +82,7 @@ def request(self, request):
return Response(self, response, response_data)
- def __call__(self, url, baseurl):
+ def request(self, url, baseurl=None):
return Request(url, baseurl, ref(self))
def clear(self):
View
4 tests/test_swoop.py
@@ -2,8 +2,8 @@
def test_simple():
s = Session(debuglevel=1)
- r = s.request('http://fansubs.ru')
- r = s.request(r.form(idx=0, values={'query':'haruhi'}))
+ r = s('http://fansubs.ru')
+ r = r.form(idx=0, values={'query':'haruhi'}).fetch()
r.save_content('/tmp/wow.html')
assert False

0 comments on commit a7e6ebf

Please sign in to comment.
Something went wrong with that request. Please try again.