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 b118421..da600cd 100644
--- a/mastodon/Mastodon.py
+++ b/mastodon/Mastodon.py
@@ -1029,21 +1029,15 @@ class Mastodon:
1029 1029
1030 response_object = None 1030 response_object = None
1031 try: 1031 try:
1032 kwargs = dict(headers=headers, files=files,
1033 timeout=self.request_timeout)
1032 if method == 'GET': 1034 if method == 'GET':
1033 response_object = requests.get(self.api_base_url + endpoint, params=params, 1035 kwargs['params'] = params
1034 headers=headers, files=files, 1036 else:
1035 timeout=self.request_timeout) 1037 kwargs['data'] = params
1036 if method == 'POST': 1038
1037 response_object = requests.post(self.api_base_url + endpoint, data=params, headers=headers, 1039 response_object = requests.request(
1038 files=files, timeout=self.request_timeout) 1040 method, self.api_base_url + endpoint, **kwargs)
1039
1040 if method == 'PATCH':
1041 response_object = requests.patch(self.api_base_url + endpoint, data=params, headers=headers,
1042 files=files, timeout=self.request_timeout)
1043
1044 if method == 'DELETE':
1045 response_object = requests.delete(self.api_base_url + endpoint, data=params, headers=headers,
1046 files=files, timeout=self.request_timeout)
1047 except Exception as e: 1041 except Exception as e:
1048 raise MastodonNetworkError("Could not complete request: %s" % e) 1042 raise MastodonNetworkError("Could not complete request: %s" % e)
1049 1043
Powered by cgit v1.2.3 (git 2.41.0)