def post_status( app, user, status, visibility='public', media_ids=None, sensitive=False, spoiler_text=None, in_reply_to_id=None, language=None, ): """ Posts a new status. https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#posting-a-new-status """ # Idempotency key assures the same status is not posted multiple times # if the request is retried. headers = {"Idempotency-Key": uuid.uuid4().hex} return http.post(app, user, '/api/v1/statuses', { 'status': status, 'media_ids[]': media_ids, 'visibility': visibility, 'sensitive': str_bool(sensitive), 'spoiler_text': spoiler_text, 'in_reply_to_id': in_reply_to_id, 'language': language, }, headers=headers).json()
def clear_notifications(app, user): http.post(app, user, '/api/v1/notifications/clear')
def upload_media(app, user, file): return http.post(app, user, '/api/v1/media', files={'file': file}).json()
def _status_action(app, user, status_id, action): url = '/api/v1/statuses/{}/{}'.format(status_id, action) return http.post(app, user, url).json()
def _account_action(app, user, account, action): url = '/api/v1/accounts/{}/{}'.format(account, action) return http.post(app, user, url).json()
def post_status(app, user, status, visibility='public', media_ids=None): return http.post(app, user, '/api/v1/statuses', { 'status': status, 'media_ids[]': media_ids, 'visibility': visibility, }).json()