Housekeeping

This commit is contained in:
Lorenz Diener 2017-04-26 12:20:44 +02:00
pare 7cfb17d698
commit 28553d7a69

Veure arxiu

@ -132,27 +132,6 @@ class Mastodon:
self.access_token = token_file.readline().rstrip() self.access_token = token_file.readline().rstrip()
def __get_token_expired(self):
"""Internal helper for oauth code"""
if self._token_expired < datetime.datetime.now():
return True
else:
return False
def __set_token_expired(self, value):
"""Internal helper for oauth code"""
self._token_expired = datetime.datetime.now() + datetime.timedelta(seconds=value)
return
def __get_refresh_token(self):
"""Internal helper for oauth code"""
return self._refresh_token
def __set_refresh_token(self, value):
"""Internal helper for oauth code"""
self._refresh_token = value
return
def auth_request_url(self, client_id = None, redirect_uris = "urn:ietf:wg:oauth:2.0:oob", scopes = ['read', 'write', 'follow']): def auth_request_url(self, client_id = None, redirect_uris = "urn:ietf:wg:oauth:2.0:oob", scopes = ['read', 'write', 'follow']):
"""Returns the url that a client needs to request the grant from the server. """Returns the url that a client needs to request the grant from the server.
https://mastodon.social/oauth/authorize?client_id=XXX&response_type=code&redirect_uris=YYY&scope=read+write+follow https://mastodon.social/oauth/authorize?client_id=XXX&response_type=code&redirect_uris=YYY&scope=read+write+follow
@ -879,6 +858,28 @@ class Mastodon:
return params return params
def __get_token_expired(self):
"""Internal helper for oauth code"""
if self._token_expired < datetime.datetime.now():
return True
else:
return False
def __set_token_expired(self, value):
"""Internal helper for oauth code"""
self._token_expired = datetime.datetime.now() + datetime.timedelta(seconds=value)
return
def __get_refresh_token(self):
"""Internal helper for oauth code"""
return self._refresh_token
def __set_refresh_token(self, value):
"""Internal helper for oauth code"""
self._refresh_token = value
return
## ##
# Exceptions # Exceptions
## ##