aboutsummaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorLorenz Diener <[email protected]>2019-06-22 20:59:53 +0200
committerLorenz Diener <[email protected]>2019-06-22 20:59:53 +0200
commitde9155b9f55103f38b9ab8230fff38f81ecbd3bd (patch)
tree40d3745a0d3feb10d580de32a4d9fb389eae3a78 /docs
parenta88492bdcf0884b922c50d04c44d909f271ff2ca (diff)
downloadmastodon.py-de9155b9f55103f38b9ab8230fff38f81ecbd3bd.tar.gz
Implement and document first half of admin API
Diffstat (limited to 'docs')
-rw-r--r--docs/index.rst53
1 files changed, 53 insertions, 0 deletions
diff --git a/docs/index.rst b/docs/index.rst
index b09b050..75773ce 100644
--- a/docs/index.rst
+++ b/docs/index.rst
@@ -263,6 +263,8 @@ User dicts
263 # set up as their moved-to address. 263 # set up as their moved-to address.
264 'bot': # Boolean indicating whether this account is automated. 264 'bot': # Boolean indicating whether this account is automated.
265 'fields': # List of up to four dicts with free-form 'name' and 'value' profile info. 265 'fields': # List of up to four dicts with free-form 'name' and 'value' profile info.
266 # For fields with "this is me" type verification, verified_at is set to the
267 # last verification date (It is None otherwise)
266 } 268 }
267 269
268 mastodon.account_verify_credentials()["source"] 270 mastodon.account_verify_credentials()["source"]
@@ -739,6 +741,30 @@ Preference dicts
739 # content warnings by default 741 # content warnings by default
740 } 742 }
741 743
744
745Admin account dicts
746~~~~~~~~~~~~~~~~~~~
747.. _admin account dicts:
748.. code-block:: python
749 {
750 'id': # The users id,
751 'username': # The users username, no leading @
752 'domain': # The users domain
753 'created_at': # The time of account creation
754 'email': # For local users, the users e-mail
755 'ip': # For local users, the users last known IP address
756 'role': # 'admin', 'moderator' or None
757 'confirmed': # For local users, False if the user has not confirmed their e-mail, True otherwise
758 'suspended': # Boolean indicating whether the user has been suspended
759 'silenced': # Boolean indicating whether the user has been suspended
760 'disabled': # For local users, boolean indicating whether the user has had their login disabled
761 'approved': # For local users, False if the user is pending, True otherwise
762 'locale': # For local users, the locale the user has set,
763 'invite_request': # If the user requested an invite, the invite request comment of that user. (TODO permanent?)
764 'invited_by_account_id': # Present if the user was invited by another user and set to the inviting users id.
765 'account': # The users account, as a standard account dict
766 }
767
742App registration and user authentication 768App registration and user authentication
743---------------------------------------- 769----------------------------------------
744Before you can use the mastodon API, you have to register your 770Before you can use the mastodon API, you have to register your
@@ -1149,6 +1175,33 @@ All crypto utilities require Mastodon.pys optional "webpush" feature dependencie
1149.. automethod:: Mastodon.push_subscription_generate_keys 1175.. automethod:: Mastodon.push_subscription_generate_keys
1150.. automethod:: Mastodon.push_subscription_decrypt_push 1176.. automethod:: Mastodon.push_subscription_decrypt_push
1151 1177
1178
1179Moderation API
1180--------------
1181These functions allow you to perform moderation actions on users and generally
1182process reports using the API. To do this, you need access to the "admin:read" and/or
1183"admin:write" scopes or their more granular variants (both for the application and the
1184access token), as well as at least moderator access. Mastodon.py will not request these
1185by default, as that would be very dangerous.
1186
1187BIG WARNING: TREAT ANY ACCESS TOKENS THAT HAVE ADMIN CREDENTIALS AS EXTREMELY, MASSIVELY
1188SENSITIVE DATA AND MAKE EXTRA SURE TO REVOKE THEM AFTER TESTING, NOT LET THEM SIT IN FILES
1189SOMEWHERE, TRACK WHICH ARE ACTIVE, ET CETERA. ANY EXPOSURE OF SUCH ACCESS TOKENS MEANS YOU
1190EXPOSE THE PERSONAL DATA OF ALL YOUR USERS TO WHOEVER HAS THESE TOKENS. TREAT THEM WITH
1191EXTREME CARE.
1192
1193This is not to say that you should not treat access tokens from admin accounts that do not
1194have admin: scopes attached with a lot of care, but be extra careful with those that do.
1195
1196.. automethod:: Mastodon.admin_accounts
1197.. automethod:: Mastodon.admin_account
1198.. automethod:: Mastodon.admin_account_enable
1199.. automethod:: Mastodon.admin_account_approve
1200.. automethod:: Mastodon.admin_account_reject
1201.. automethod:: Mastodon.admin_account_unsilence
1202.. automethod:: Mastodon.admin_account_unsuspend
1203.. automethod:: Mastodon.admin_account_moderate
1204
1152Acknowledgements 1205Acknowledgements
1153---------------- 1206----------------
1154Mastodon.py contains work by a large amount of contributors, many of which have 1207Mastodon.py contains work by a large amount of contributors, many of which have
Powered by cgit v1.2.3 (git 2.41.0)