Skip to content
Browse files

now using str.join :)

  • Loading branch information...
1 parent d4d8bf5 commit b33c07da8dd2ff6389547a47a0d8b9138fa7f654 @reiven committed Jan 19, 2012
Showing with 14 additions and 7 deletions.
  1. +14 −7 pynientos/pynilib.py
View
21 pynientos/pynilib.py
@@ -88,16 +88,23 @@ def _method(api=api, id="", **params):
def get(self, path, params=""):
""" construct the complete GET url and returns the JSON response """
- return self.parse_response(self.client.request(
- self.site + path + self.encode_params(params),
- "GET",
- ))
+ if params:
+ return self.parse_response(self.client.request(
+ str.join('', (self.site, path, self.encode_params(params))),
+ "GET",
+ ))
+
+ else:
+ return self.parse_response(self.client.request(
+ str.join('', (self.site, path)),
+ "GET",
+ ))
def post(self, path, params={}):
return self.parse_response(self.client.request(
- self.site + path,
- "POST", body=self.encode_post_params(params)
- ))
+ str.join('', (self.site, path)),
+ "POST", body=self.encode_post_params(params)
+ ))
def encode_params(self, params={}):
return str.join('', ('&', urllib.urlencode(params)))

0 comments on commit b33c07d

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