Clearified the use of 'code' in log_in()

pull/355/head
Lasse Edfast 2023-08-21 22:20:23 +02:00 zatwierdzone przez GitHub
rodzic cd86887d88
commit 5c28d1ba75
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
2 zmienionych plików z 10 dodań i 1 usunięć

Wyświetl plik

@ -27,6 +27,15 @@ Feature complete for public API as of Mastodon version 3.5.5 and easy to get sta
to_file = 'pytooter_usercred.secret'
)
# If you are logging in for the first time you need to give permissions to the app
# via OAuth, at the URL given by auth_request_url() and then pass code instead of
# username and password.
mastodon.log_in(
to_file = 'pytooter_usercred.secret',
code='code_from_oauth,
scopes=['read', 'write'],
)
# Note that this won't work when using 2FA - you'll have to use OAuth, in that case.
# To post, create an actual API instance:
mastodon = Mastodon(access_token = 'pytooter_usercred.secret')

Wyświetl plik

@ -315,7 +315,7 @@ class Mastodon(Internals):
For OAuth 2, obtain a code via having your user go to the URL returned by
:ref:`auth_request_url() <auth_request_url()>` and pass it as the code parameter. In this case,
make sure to also pass the same redirect_uri parameter as you used when
generating the auth request URL.
generating the auth request URL. If passing `code`you should not pass `username` or `password`.
Returns the access token as a string.
"""