mirror of
https://github.com/ihabunek/toot.git
synced 2025-01-03 14:56:37 -05:00
parent
ea94d6bfe1
commit
8f93b255ad
@ -1,6 +1,10 @@
|
||||
Changelog
|
||||
---------
|
||||
|
||||
**0.19.0 (TBA)**
|
||||
|
||||
* Add support for replying to a toot (#6)
|
||||
|
||||
**0.18.0 (2018-06-12)**
|
||||
|
||||
* Add support for public, tag and list timelines in `toot timeline` (#52)
|
||||
|
@ -39,6 +39,7 @@ def test_post_defaults(mock_post, capsys):
|
||||
'media_ids[]': None,
|
||||
'sensitive': False,
|
||||
'spoiler_text': None,
|
||||
'in_reply_to_id': None,
|
||||
})
|
||||
|
||||
out, err = capsys.readouterr()
|
||||
@ -49,7 +50,13 @@ def test_post_defaults(mock_post, capsys):
|
||||
|
||||
@mock.patch('toot.http.post')
|
||||
def test_post_with_options(mock_post, capsys):
|
||||
args = ['Hello world', '--visibility', 'unlisted', '--sensitive', '--spoiler-text', 'Spoiler!']
|
||||
args = [
|
||||
'Hello world',
|
||||
'--visibility', 'unlisted',
|
||||
'--sensitive',
|
||||
'--spoiler-text', 'Spoiler!',
|
||||
'--reply-to', '123'
|
||||
]
|
||||
|
||||
mock_post.return_value = MockResponse({
|
||||
'url': 'https://habunek.com/@ihabunek/1234567890'
|
||||
@ -63,6 +70,7 @@ def test_post_with_options(mock_post, capsys):
|
||||
'visibility': 'unlisted',
|
||||
'sensitive': True,
|
||||
'spoiler_text': "Spoiler!",
|
||||
'in_reply_to_id': 123,
|
||||
})
|
||||
|
||||
out, err = capsys.readouterr()
|
||||
|
17
toot/api.py
17
toot/api.py
@ -76,14 +76,27 @@ def request_access_token(app, authorization_code):
|
||||
return http.process_response(response).json()
|
||||
|
||||
|
||||
def post_status(app, user, status, visibility='public', media_ids=None,
|
||||
sensitive=False, spoiler_text=None):
|
||||
def post_status(
|
||||
app,
|
||||
user,
|
||||
status,
|
||||
visibility='public',
|
||||
media_ids=None,
|
||||
sensitive=False,
|
||||
spoiler_text=None,
|
||||
in_reply_to_id=None
|
||||
):
|
||||
"""
|
||||
Posts a new status.
|
||||
https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#posting-a-new-status
|
||||
"""
|
||||
return http.post(app, user, '/api/v1/statuses', {
|
||||
'status': status,
|
||||
'media_ids[]': media_ids,
|
||||
'visibility': visibility,
|
||||
'sensitive': sensitive,
|
||||
'spoiler_text': spoiler_text,
|
||||
'in_reply_to_id': in_reply_to_id,
|
||||
}).json()
|
||||
|
||||
|
||||
|
@ -62,6 +62,7 @@ def post(app, user, args):
|
||||
media_ids=media_ids,
|
||||
sensitive=args.sensitive,
|
||||
spoiler_text=args.spoiler_text,
|
||||
in_reply_to_id=args.reply_to,
|
||||
)
|
||||
|
||||
print_out("Toot posted: <green>{}</green>".format(response.get('url')))
|
||||
|
@ -198,7 +198,11 @@ POST_COMMANDS = [
|
||||
(["-p", "--spoiler-text"], {
|
||||
"type": str,
|
||||
"help": 'text to be shown as a warning before the actual content',
|
||||
})
|
||||
}),
|
||||
(["-r", "--reply-to"], {
|
||||
"type": int,
|
||||
"help": 'local ID of the status you want to reply to',
|
||||
}),
|
||||
],
|
||||
require_auth=True,
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user