2022-08-27 13:05:15 +02:00
|
|
|
# Mastodonplus.py
|
2022-09-21 22:47:52 +02:00
|
|
|
Fork of Python wrapper for the Mastodon (https://github.com/mastodon/mastodon) API.
|
2022-08-27 13:05:15 +02:00
|
|
|
The goal of this fork is to add all 'new' Mastodon API's endpoints to the excellent [halcy's wrapper](https://github.com/halcy/Mastodon.py).
|
|
|
|
|
2022-08-27 13:16:22 +02:00
|
|
|
#### Register your app! This only needs to be done once. Uncomment the code and substitute in your information.
|
2022-08-27 13:05:15 +02:00
|
|
|
|
|
|
|
```
|
|
|
|
from mastodon import Mastodon
|
|
|
|
|
2022-08-27 13:16:22 +02:00
|
|
|
Mastodon.create_app(
|
2022-08-27 13:05:15 +02:00
|
|
|
'pytooterapp',
|
2022-08-27 13:16:22 +02:00
|
|
|
api_base_url = 'https://your-mastodon.server'
|
2022-08-27 13:05:15 +02:00
|
|
|
to_file = 'pytooter_clientcred.secret'
|
|
|
|
)
|
|
|
|
```
|
2022-08-27 13:16:22 +02:00
|
|
|
#### Then login. This can be done every time, or use persisted.
|
2022-08-27 13:05:15 +02:00
|
|
|
|
|
|
|
```
|
|
|
|
from mastodon import Mastodon
|
|
|
|
|
|
|
|
mastodon = Mastodon(
|
|
|
|
client_id = 'pytooter_clientcred.secret',
|
|
|
|
api_base_url = 'https://your-mastodon.server'
|
|
|
|
)
|
|
|
|
mastodon.log_in(
|
|
|
|
'my_login_email@example.com',
|
|
|
|
'incrediblygoodpassword',
|
|
|
|
to_file = 'pytooter_usercred.secret'
|
|
|
|
)
|
|
|
|
```
|
2022-08-27 13:16:22 +02:00
|
|
|
#### To post, create an actual API instance.
|
2022-08-27 13:05:15 +02:00
|
|
|
|
2022-08-27 13:09:08 +02:00
|
|
|
```
|
2022-08-27 13:05:15 +02:00
|
|
|
from mastodon import Mastodon
|
|
|
|
|
|
|
|
mastodon = Mastodon(
|
|
|
|
access_token = 'pytooter_usercred.secret',
|
|
|
|
api_base_url = 'https://your-mastodon.server>'
|
|
|
|
)
|
|
|
|
mastodon.toot('Tooting from python using #mastodonpy !')
|
|
|
|
```
|
|
|
|
You can install Mastodonplus.py via pypi:
|
|
|
|
|
|
|
|
```
|
2022-08-27 13:09:08 +02:00
|
|
|
# Python 3
|
2022-08-27 13:05:15 +02:00
|
|
|
pip3 install Mastodonplus.py
|
|
|
|
```
|
2022-08-27 13:16:22 +02:00
|
|
|
#### New features
|
2022-08-27 13:09:08 +02:00
|
|
|
|
2022-09-21 22:47:52 +02:00
|
|
|
* 26.8.2022. Mastodon v3.6.0. Added New endpoints: /api/v1/admin/domain_blocks (list,show by id, delete and create)
|
2022-08-27 19:08:02 +02:00
|
|
|
* 27.8.2022. Mastodon v3.1.4. Added 'remote" param to GET /api/v1/timelines/public REST API
|
|
|
|
* 27.8.2022. Mastodon v3.1.4. Added GET /api/v1/streaming/public/remote (Mastodon.stream_remote())
|
2022-09-06 22:17:18 +02:00
|
|
|
* 06.9.2022. Mastodon v3.2.0. Added POST /api/v1/accounts/:account_id/note with comment param. (Mastodon.accounts_note(id=account_id, comment='comment')
|
2022-09-21 22:47:52 +02:00
|
|
|
* 06.9.2022. Mastodon v3.6.0. Added GET /api/v1/admin/ip_blocks (Mastodon.admin_ip_blocks_list(max_id=None, min_id=None, since_id=None, limit=None)
|
|
|
|
* 06.9.2022. Mastodon v3.6.0. Added DELETE /api/v1/admin/ip_blocks/:id (Mastodon.admin_ip_blocks_delete(id=None)
|
|
|
|
* 06.9.2022. Mastodon v3.6.0. Added POST /api/v1/admin/ip_blocks (Mastodon.admin_ip_blocks_create(self, ip=None, severity=None, comment=None, expires_in=None)
|
2022-09-06 22:17:18 +02:00
|
|
|
severity possible values are: sign_up_requires_approval, sign_up_block, no_access
|