diff options
-rw-r--r-- | mastodon/Mastodon.py | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 88daac8..4717674 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -131,27 +131,6 @@ class Mastodon: | |||
131 | with open(self.access_token, 'r') as token_file: | 131 | with open(self.access_token, 'r') as token_file: |
132 | self.access_token = token_file.readline().rstrip() | 132 | self.access_token = token_file.readline().rstrip() |
133 | 133 | ||
134 | |||
135 | def __get_token_expired(self): | ||
136 | """Internal helper for oauth code""" | ||
137 | if self._token_expired < datetime.datetime.now(): | ||
138 | return True | ||
139 | else: | ||
140 | return False | ||
141 | |||
142 | def __set_token_expired(self, value): | ||
143 | """Internal helper for oauth code""" | ||
144 | self._token_expired = datetime.datetime.now() + datetime.timedelta(seconds=value) | ||
145 | return | ||
146 | |||
147 | def __get_refresh_token(self): | ||
148 | """Internal helper for oauth code""" | ||
149 | return self._refresh_token | ||
150 | |||
151 | def __set_refresh_token(self, value): | ||
152 | """Internal helper for oauth code""" | ||
153 | self._refresh_token = value | ||
154 | return | ||
155 | 134 | ||
156 | def auth_request_url(self, client_id = None, redirect_uris = "urn:ietf:wg:oauth:2.0:oob", scopes = ['read', 'write', 'follow']): | 135 | def auth_request_url(self, client_id = None, redirect_uris = "urn:ietf:wg:oauth:2.0:oob", scopes = ['read', 'write', 'follow']): |
157 | """Returns the url that a client needs to request the grant from the server. | 136 | """Returns the url that a client needs to request the grant from the server. |
@@ -879,6 +858,28 @@ class Mastodon: | |||
879 | 858 | ||
880 | return params | 859 | return params |
881 | 860 | ||
861 | |||
862 | def __get_token_expired(self): | ||
863 | """Internal helper for oauth code""" | ||
864 | if self._token_expired < datetime.datetime.now(): | ||
865 | return True | ||
866 | else: | ||
867 | return False | ||
868 | |||
869 | def __set_token_expired(self, value): | ||
870 | """Internal helper for oauth code""" | ||
871 | self._token_expired = datetime.datetime.now() + datetime.timedelta(seconds=value) | ||
872 | return | ||
873 | |||
874 | def __get_refresh_token(self): | ||
875 | """Internal helper for oauth code""" | ||
876 | return self._refresh_token | ||
877 | |||
878 | def __set_refresh_token(self, value): | ||
879 | """Internal helper for oauth code""" | ||
880 | self._refresh_token = value | ||
881 | return | ||
882 | |||
882 | ## | 883 | ## |
883 | # Exceptions | 884 | # Exceptions |
884 | ## | 885 | ## |