Skip to content

Commit

Permalink
Clean up a bit of code and add in string coercion to the '_get_querys…
Browse files Browse the repository at this point in the history
…tring' method since it would be natural to send ints as values for some of the arguments.
  • Loading branch information
mattdeboard committed Oct 17, 2012
1 parent 0abc7e7 commit 348a24d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions python_usdol.py
Expand Up @@ -88,13 +88,12 @@ def _get_querystring(self, **kwargs):
"""
qs = []
for arg in kwargs:
if kwargs[arg]:
for key, value in kwargs.items():
if value:
# `filter` is a keyword in Python, so I avoid using it by
# adding a _ to the end, then removing it here.
key = arg.replace('_', '')
val = kwargs[arg].replace(' ', '+')
qs.append("$%s=%s" % (key, val))
qs.append("$%s=%s" %
(key.replace('_', ''), str(value).replace(' ', '+')))
return '?' + string.join(qs, '&')

def _get_request(self, qs='', fmt='json'):
Expand Down

0 comments on commit 348a24d

Please sign in to comment.