Skip to content

Commit

Permalink
Fix create method: now sends up data.
Browse files Browse the repository at this point in the history
  • Loading branch information
lextoumbourou committed Sep 16, 2015
1 parent 03bcb2f commit d5c6d18
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ if __name__ == "__main__":

## Changelog

### 0.0.5

* Fix bug with ``create`` method not sending up params.

### 0.0.4

* Ensure urls passed to Treq are bytes, not unicode.
Expand Down
15 changes: 13 additions & 2 deletions txstripe/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,18 @@ def make_request(
if txstripe.api_version is not None:
headers['Stripe-Version'] = txstripe.api_version

if method == 'get' or method == 'delete':
data = None
elif method == 'post':
data = params
params = None
else:
raise error.APIConnectionError(
'Unrecognized HTTP method %r. This may indicate a bug in the '
'Stripe bindings.' % (method,))

resp = yield treq.request(
method, abs_url, params=params, headers=headers, **kwargs)
method, abs_url, params=params, data=data, headers=headers, **kwargs)

if resp.code >= 400:
yield util.handle_api_error(resp)
Expand Down Expand Up @@ -193,7 +203,8 @@ def create(
url = cls.class_url()
headers = populate_headers(idempotency_key)
return make_request(
cls, 'post', url, stripe_account=stripe_account, headers=headers)
cls, 'post', url, stripe_account=stripe_account,
headers=headers, params=params)


class UpdateableAPIResource(APIResource):
Expand Down

0 comments on commit d5c6d18

Please sign in to comment.