Skip to content

Commit 6a87bd8

Browse files
committed
fix post data bug
1 parent c88aec4 commit 6a87bd8

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

hackpad_api/hackpad.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def site_options(self):
118118
api_link = 'options'
119119
return self.do_api_request(api_link, 'GET')
120120

121-
def do_api_request(self, path, method, params={}, body='', content_type='text/plain'):
121+
def do_api_request(self, path, method, post_data={}, body='', content_type='text/plain'):
122122
method = method.upper()
123123
hackpad = {}
124124
try:
@@ -131,14 +131,18 @@ def do_api_request(self, path, method, params={}, body='', content_type='text/pl
131131
'client_key': self.consumer_key,
132132
'client_secret': self.consumer_secret
133133
}
134+
135+
for key in post_data.keys():
136+
params[key] = post_data[key]
134137

135138
hackpad_api = OAuth1Session(**params)
136139

137-
if method.lower() == 'post':
138-
r = hackpad_api.post(path, data=params)
140+
if method == 'POST':
141+
142+
r = hackpad_api.post(path, data=body)
139143
hackpad = r.json()
140144
else:
141-
r = hackpad_api.get(path, params=params)
145+
r = hackpad_api.get(path)
142146

143147
try:
144148
hackpad = r.json()

0 commit comments

Comments
 (0)