diff options
Diffstat (limited to 'mastodon')
-rw-r--r-- | mastodon/Mastodon.py | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/mastodon/Mastodon.py b/mastodon/Mastodon.py index 68f9e56..003402f 100644 --- a/mastodon/Mastodon.py +++ b/mastodon/Mastodon.py | |||
@@ -134,7 +134,6 @@ class Mastodon: | |||
134 | 134 | ||
135 | 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']): |
136 | """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. |
137 | https://mastodon.social/oauth/authorize?client_id=XXX&response_type=code&redirect_uris=YYY&scope=read+write+follow | ||
138 | """ | 137 | """ |
139 | if client_id is None: | 138 | if client_id is None: |
140 | client_id = self.client_id | 139 | client_id = self.client_id |
@@ -155,22 +154,20 @@ class Mastodon: | |||
155 | code = None, redirect_uri = "urn:ietf:wg:oauth:2.0:oob", refresh_token = None,\ | 154 | code = None, redirect_uri = "urn:ietf:wg:oauth:2.0:oob", refresh_token = None,\ |
156 | scopes = ['read', 'write', 'follow'], to_file = None): | 155 | scopes = ['read', 'write', 'follow'], to_file = None): |
157 | """ | 156 | """ |
158 | Docs: https://github.com/doorkeeper-gem/doorkeeper/wiki/Interacting-as-an-OAuth-client-with-Doorkeeper | 157 | Your username is the e-mail you use to log in into mastodon. |
159 | 158 | ||
160 | Notes: | 159 | Can persist access token to file, to be used in the constructor. |
161 | Your username is the e-mail you use to log in into mastodon. | 160 | |
162 | 161 | Supports refresh_token but Mastodon.social doesn't implement it at the moment. | |
163 | Can persist access token to file, to be used in the constructor. | 162 | |
164 | 163 | Handles password, authorization_code, and refresh_token authentication. | |
165 | Supports refresh_token but Mastodon.social doesn't implement it at the moment. | 164 | |
166 | 165 | Will throw a MastodonIllegalArgumentError if username / password | |
167 | Handles password, authorization_code, and refresh_token authentication. | 166 | are wrong, scopes are not valid or granted scopes differ from requested. |
168 | 167 | ||
169 | Will throw a MastodonIllegalArgumentError if username / password | 168 | For OAuth2 documentation, compare https://github.com/doorkeeper-gem/doorkeeper/wiki/Interacting-as-an-OAuth-client-with-Doorkeeper |
170 | are wrong, scopes are not valid or granted scopes differ from requested. | ||
171 | 169 | ||
172 | Returns: | 170 | Returns the access token. |
173 | str @access_token | ||
174 | """ | 171 | """ |
175 | if username is not None and password is not None: | 172 | if username is not None and password is not None: |
176 | params = self.__generate_params(locals(), ['scopes', 'to_file', 'code', 'refresh_token']) | 173 | params = self.__generate_params(locals(), ['scopes', 'to_file', 'code', 'refresh_token']) |