Merge pull request #7 from fpiesche/master
Add support for sensitive toots and visibility settings.
This commit is contained in:
commit
798873296b
S'han modificat 1 arxius amb 124 adicions i 106 eliminacions
|
@ -318,17 +318,35 @@ class Mastodon:
|
||||||
###
|
###
|
||||||
# Writing data: Statuses
|
# Writing data: Statuses
|
||||||
###
|
###
|
||||||
def status_post(self, status, in_reply_to_id = None, media_ids = None):
|
def status_post(self, status, in_reply_to_id = None, media_ids = None, sensitive = False, visibility = ''):
|
||||||
"""
|
"""
|
||||||
Post a status. Can optionally be in reply to another status and contain
|
Post a status. Can optionally be in reply to another status and contain
|
||||||
up to four pieces of media (Uploaded via media_post()). media_ids can
|
up to four pieces of media (Uploaded via media_post()). media_ids can
|
||||||
also be the media dicts returned by media_post - they are unpacked
|
also be the media dicts returned by media_post - they are unpacked
|
||||||
automatically.
|
automatically.
|
||||||
|
|
||||||
|
The 'sensitive' boolean decides whether or not media attached to the post
|
||||||
|
should be marked as sensitive, which hides it by default on the Mastodon
|
||||||
|
web front-end.
|
||||||
|
|
||||||
|
The visibility parameter is a string value and matches the visibility
|
||||||
|
option on the /api/v1/status POST API endpoint. It accepts any of:
|
||||||
|
'private' - post will be visible only to followers
|
||||||
|
'unlisted' - post will be public but not appear on the public timeline
|
||||||
|
'public' - post will be public
|
||||||
|
|
||||||
|
If not passed in, visibility defaults to match the current account's
|
||||||
|
privacy setting (private if the account is locked, public otherwise).
|
||||||
|
|
||||||
Returns a toot dict with the new status.
|
Returns a toot dict with the new status.
|
||||||
"""
|
"""
|
||||||
params_initial = locals()
|
params_initial = locals()
|
||||||
|
|
||||||
|
# Validate visibility parameter
|
||||||
|
valid_visibilities = ['private', 'public', 'unlisted', '']
|
||||||
|
if params_initial['visibility'].lower() not in valid_visibilities:
|
||||||
|
raise ValueError('Invalid visibility value! Acceptable values are %s' % valid_visibilities)
|
||||||
|
|
||||||
if media_ids != None:
|
if media_ids != None:
|
||||||
try:
|
try:
|
||||||
media_ids_proper = []
|
media_ids_proper = []
|
||||||
|
|
Loading…
Referencia en una nova incidència