aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'mastodon')
-rw-r--r--mastodon/Mastodon.py22
1 files changed, 8 insertions, 14 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py
index d57fb91..4ffdde1 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -1055,21 +1055,15 @@ class Mastodon:
1055 1055
1056 response_object = None 1056 response_object = None
1057 try: 1057 try:
1058 kwargs = dict(headers=headers, files=files,
1059 timeout=self.request_timeout)
1058 if method == 'GET': 1060 if method == 'GET':
1059 response_object = requests.get(self.api_base_url + endpoint, params=params, 1061 kwargs['params'] = params
1060 headers=headers, files=files, 1062 else:
1061 timeout=self.request_timeout) 1063 kwargs['data'] = params
1062 if method == 'POST': 1064
1063 response_object = requests.post(self.api_base_url + endpoint, data=params, headers=headers, 1065 response_object = requests.request(
1064 files=files, timeout=self.request_timeout) 1066 method, self.api_base_url + endpoint, **kwargs)
1065
1066 if method == 'PATCH':
1067 response_object = requests.patch(self.api_base_url + endpoint, data=params, headers=headers,
1068 files=files, timeout=self.request_timeout)
1069
1070 if method == 'DELETE':
1071 response_object = requests.delete(self.api_base_url + endpoint, data=params, headers=headers,
1072 files=files, timeout=self.request_timeout)
1073 except Exception as e: 1067 except Exception as e:
1074 raise MastodonNetworkError("Could not complete request: %s" % e) 1068 raise MastodonNetworkError("Could not complete request: %s" % e)
1075 1069
Powered by cgit v1.2.3 (git 2.41.0)