Skip to content

Commit

Permalink
Readability improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
martinmelin committed Mar 5, 2015
1 parent 0bd8c2c commit 40c7178
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions slack/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,19 @@

def get(method, params):
url = _build_url(method)
return _parse_response(requests.get(url, params=params, verify=True))
response = requests.get(url, params=params, verify=True)
return _parse_response(response)

def post(method, data):
url = _build_url(method)
return _parse_response(requests.post(url, data=data, verify=True))
response = requests.post(url, data=data, verify=True)
return _parse_response(response)

def _parse_response(response):
try:
response = response.json()
except ValueError as e:
_raise_error_if_not_ok({'ok': False, 'error': e})
response = {'ok': False, 'error': e}
_raise_error_if_not_ok(response)
return response

Expand Down

0 comments on commit 40c7178

Please sign in to comment.