Skip to content

Commit f100204

Browse files
1 parent 7471cd4 commit f100204

File tree

5 files changed

+14
-4
lines changed

5 files changed

+14
-4
lines changed

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,5 @@ dist
2020
*.pyo
2121
*.tmp*
2222
.DS_Store
23-
.idea
23+
.idea
24+
test.py

HISTORY.rst

+7
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,13 @@
33
History
44
-------
55

6+
1.0.1 (2013-05-29)
7+
++++++++++++++++++
8+
9+
- Hotfix image uploading (not sure why we have to pass ``params`` AND ``data`` to the POST, hotfix for the time being...)
10+
- Allow for ints and floats (and longs in Python 2) to be passed as parameters to Tumblpy Tumblr API functions
11+
12+
613
1.0.0 (2013-05-23)
714
++++++++++++++++++
815

tumblpy/api.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def request(self, endpoint, method='GET', blog_url=None,
120120
if method == 'get':
121121
response = func(url, params=params, allow_redirects=False)
122122
else:
123-
response = func(url, data=params, files=files,
123+
response = func(url, params=params, data=params, files=files,
124124
allow_redirects=False)
125125
except requests.exceptions.RequestException:
126126
raise TumblpyError('An unknown error occurred.')

tumblpy/compat.py

+2
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,11 @@
2121
from cgi import parse_qsl
2222

2323
basestring = basestring
24+
numeric_types = (int, long, float)
2425

2526

2627
elif is_py3:
2728
from urllib.parse import urlencode, parse_qsl
2829

2930
basestring = (str, bytes)
31+
numeric_types = (int, float)

tumblpy/helpers.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from .compat import basestring
1+
from .compat import basestring, numeric_types
22

33

44
def _split_params_and_files(params_):
@@ -7,7 +7,7 @@ def _split_params_and_files(params_):
77
for k, v in params_.items():
88
if hasattr(v, 'read') and callable(v.read):
99
files[k] = v
10-
elif isinstance(v, basestring):
10+
elif isinstance(v, basestring) or isinstance(v, numeric_types):
1111
params[k] = v
1212
elif isinstance(v, bool):
1313
params[k] = 'true' if v else 'false'

0 commit comments

Comments
 (0)