Skip to content

Commit

Permalink
Merge pull request #10 from Grissess/master
Browse files Browse the repository at this point in the history
Linker.call keyword arguments as parameters
  • Loading branch information
successamp committed Aug 29, 2014
2 parents 24a31b1 + d55768e commit 82f11b6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions hypchat/restobject.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,16 +65,21 @@ def _object_hook(obj):
return obj
return json.JSONDecoder(object_hook=_object_hook).decode(text)

def __call__(self, expand=None):
def __call__(self, expand=None, **kwargs):
"""
Actually perform the request
"""
params = None
params = {}
if expand is not None:
if isinstance(expand, basestring):
params = {'expand': expand}
else:
params = {'expand': ','.join(expand)}
if kwargs:
merge_params = {}
for k, v in kwargs.iteritems():
merge_params[k.replace('_', '-')] = v
params.update(merge_params)

rv = self._obj_from_text(self._requests.get(self.url, params=params).text, self._requests)
rv._requests = self._requests
Expand Down

0 comments on commit 82f11b6

Please sign in to comment.