Last active
February 11, 2021 21:54
-
-
Save frankenstein91/01f8f7db9291d6a7e7e1533047129930 to your computer and use it in GitHub Desktop.
mastodontech sppedtest bot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import multiprocessing | |
import atoot | |
import asyncio | |
import speedtest #speedtest-cli | |
async def mastodon_bot(): | |
instance = "" | |
access_token = "" | |
client = await atoot.MastodonAPI.create(instance, access_token=access_token) | |
resp = await client.verify_account_credentials() | |
st = speedtest.Speedtest() | |
Download = st.download() / 1024.0 / 1024.0 | |
Upload = st.upload() / 1024.0 / 1024.0 | |
text = f"#MeinInternet ist heute {format(Download,'.3f')} MBit/s down und {format(Upload,'.3f')} MBit/s up." | |
await client.create_status(status=text) | |
await client.close() | |
if __name__ == '__main__': | |
multiprocessing.freeze_support() | |
asyncio.run(mastodon_bot()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can install the needed libs with:
pip install speedtest-cli atoot
and you can run it with systemd: