diff options
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/Mastodon.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index eb16bfa..fff365f 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -18,10 +18,9 @@ class Mastodon: | |||
18 | 18 | ||
19 | Presently, only username-password login is supported, somebody please | 19 | Presently, only username-password login is supported, somebody please |
20 | patch in Real Proper OAuth if desired. | 20 | patch in Real Proper OAuth if desired. |
21 | |||
22 | KNOWN BUGS: Media api does not work, reason unclear. | ||
23 | """ | 21 | """ |
24 | __DEFAULT_BASE_URL = 'https://mastodon.social' | 22 | __DEFAULT_BASE_URL = 'https://mastodon.social' |
23 | __DEBUG_REQUESTS = False | ||
25 | 24 | ||
26 | ### | 25 | ### |
27 | # Registering apps | 26 | # Registering apps |
@@ -178,7 +177,7 @@ class Mastodon: | |||
178 | Returns statuses by user. Same options as timeline are permitted. | 177 | Returns statuses by user. Same options as timeline are permitted. |
179 | """ | 178 | """ |
180 | params = self.__generate_params(locals(), ['id']) | 179 | params = self.__generate_params(locals(), ['id']) |
181 | return self.__api_request('GET', '/api/v1/accounts/' + str(id) + '/statuses') | 180 | return self.__api_request('GET', '/api/v1/accounts/' + str(id) + '/statuses', params) |
182 | 181 | ||
183 | def account_following(self, id): | 182 | def account_following(self, id): |
184 | """ | 183 | """ |
@@ -342,9 +341,16 @@ class Mastodon: | |||
342 | response = None | 341 | response = None |
343 | headers = None | 342 | headers = None |
344 | 343 | ||
344 | |||
345 | if self.access_token != None: | 345 | if self.access_token != None: |
346 | headers = {'Authorization': 'Bearer ' + self.access_token} | 346 | headers = {'Authorization': 'Bearer ' + self.access_token} |
347 | 347 | ||
348 | if __DEBUG_REQUESTS = True: | ||
349 | print('Mastodon: Request to endpoint "' + endpoint + '" using method "' + method + '".') | ||
350 | print('Parameters: ' + str(params)) | ||
351 | print('Headers: ' + str(headers)) | ||
352 | print('Files: ' + str(files)) | ||
353 | |||
348 | if method == 'GET': | 354 | if method == 'GET': |
349 | response = requests.get(self.api_base_url + endpoint, data = params, headers = headers, files = files) | 355 | response = requests.get(self.api_base_url + endpoint, data = params, headers = headers, files = files) |
350 | 356 | ||