Permalink
Browse files

docstrings and stuff

  • Loading branch information...
1 parent 42ae14e commit 58fdf428b6ff4feddaf94acab84cc9b63b701636 @zalun zalun committed Oct 8, 2012
Showing with 7 additions and 1 deletion.
  1. +7 −1 marketplace/connection.py
@@ -34,6 +34,7 @@ class Connection:
Marketplace API
"""
signature_method = oauth.SignatureMethod_HMAC_SHA1()
+ consumer = None
def __init__(self, consumer_key, consumer_secret):
self.set_consumer(consumer_key, consumer_secret)
@@ -63,7 +64,7 @@ def prepare_request(self, method, url, body=''):
@staticmethod
def _get_error_reason(response):
- """extract error reason from the response. It might be either
+ """Extract error reason from the response. It might be either
the 'reason' or the entire response
"""
body = response.json
@@ -72,6 +73,9 @@ def _get_error_reason(response):
return response.content
def fetch(self, method, url, data=None, expected_status_code=None):
+ """Prepare the headers, encode data, call API and provide
+ data it returns
+ """
kwargs = self.prepare_request(method, url, data)
response = getattr(requests, method.lower())(url, **kwargs)
if response.status_code >= 400:
@@ -82,4 +86,6 @@ def fetch(self, method, url, data=None, expected_status_code=None):
return response
def fetch_json(self, method, url, data=None, expected_status_code=None):
+ """Return json decoded data from fetch
+ """
return self.fetch(method, url, data, expected_status_code).json()

0 comments on commit 58fdf42

Please sign in to comment.