atoot is a Python library providing an easy way to create Mastodon API applications.
Key features
Python 3 library
Asynchronous networking with asyncio and aiohttp
Every API method is implemented https://docs.joinmastodon.org/methods/
Client as a context manager
Results pagination
Requirements
aiohttp
pytest (for tests)
Getting started
Install
pip install atoot
Use
Basic usage example:
import atoot
import asyncio
async def mastodon_bot():
instance = "botsin.space"
access_token = "YOUR_APPLICATION_ACCESS_TOKEN"
client = await atoot.MastodonAPI.create(instance, access_token=access_token)
resp = await client.verify_account_credentials()
print(resp)
await client.close()
asyncio.run(mastodon_bot())
Using client as a context manager, get 5 pages of home timeline and all notifications:
async def mastodon_bot():
instance = "botsin.space"
access_token = "YOUR_APPLICATION_ACCESS_TOKEN"
async with atoot.client(instance, access_token=access_token) as c:
home = await c.get_n_pages(c.home_timeline(limit=20), n=5)
print("Home timeline:", home)
notifs = await c.get_all(c.get_notifications())
print("Notifications:", notifs)
License
MIT
Release files for atoot 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| atoot-1.0.2.tar.gz | 11.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| atoot-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 23.7 kB
Release files / atoot-1.0.2.tar.gz
| Download URL | atoot-1.0.2.tar.gz |
|---|---|
| Size | 11.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2c315bf47761e42c248083b2c51c4cfbef5a360358af422c5471a5caff9f251d
|
|
BLAKE2b-256 checksum How to use checksums |
723b9cc3061b12b188d4adbff3da62bfb374f3105b1aa7551331d160dc6d5f40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.3
|
Release files / atoot-1.0.2-py3-none-any.whl
| Download URL | atoot-1.0.2-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ca3d2f8563ab2010ff066a1716278435600ed793ed2e067a933bd0d57fe40b22
|
|
BLAKE2b-256 checksum How to use checksums |
a64cf3ae75cd13217eeea99f9babcc7c2a03a9f1c95443f3d98921205b81fbb4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.7.3
|