Fixed a bug in account_statuses

This commit is contained in:
Lorenz Diener 2016-11-24 20:03:08 +01:00
pare 7a60387e53
commit 2267e51efd

Veure arxiu

@ -18,10 +18,9 @@ class Mastodon:
Presently, only username-password login is supported, somebody please Presently, only username-password login is supported, somebody please
patch in Real Proper OAuth if desired. patch in Real Proper OAuth if desired.
KNOWN BUGS: Media api does not work, reason unclear.
""" """
__DEFAULT_BASE_URL = 'https://mastodon.social' __DEFAULT_BASE_URL = 'https://mastodon.social'
__DEBUG_REQUESTS = False
### ###
# Registering apps # Registering apps
@ -178,7 +177,7 @@ class Mastodon:
Returns statuses by user. Same options as timeline are permitted. Returns statuses by user. Same options as timeline are permitted.
""" """
params = self.__generate_params(locals(), ['id']) params = self.__generate_params(locals(), ['id'])
return self.__api_request('GET', '/api/v1/accounts/' + str(id) + '/statuses') return self.__api_request('GET', '/api/v1/accounts/' + str(id) + '/statuses', params)
def account_following(self, id): def account_following(self, id):
""" """
@ -342,9 +341,16 @@ class Mastodon:
response = None response = None
headers = None headers = None
if self.access_token != None: if self.access_token != None:
headers = {'Authorization': 'Bearer ' + self.access_token} headers = {'Authorization': 'Bearer ' + self.access_token}
if __DEBUG_REQUESTS = True:
print('Mastodon: Request to endpoint "' + endpoint + '" using method "' + method + '".')
print('Parameters: ' + str(params))
print('Headers: ' + str(headers))
print('Files: ' + str(files))
if method == 'GET': if method == 'GET':
response = requests.get(self.api_base_url + endpoint, data = params, headers = headers, files = files) response = requests.get(self.api_base_url + endpoint, data = params, headers = headers, files = files)