---
title: "💭 Mastodon.py — Mastodon.py 1.8.1 documentation"
description: "!https://mastodonpy.readthedocs.io/en/stable/"
date: 2023-12-21
published: true
tags:
  - python
  - thought
template: link
---


<div class="embed-card embed-card-external">
  <a href="https://mastodonpy.readthedocs.io/en/stable/" class="embed-card-link" target="_blank" rel="noopener noreferrer">
    <div class="embed-card-content">
      <div class="embed-card-title">Mastodon.py — Mastodon.py 2.2.1 documentation</div>
      <div class="embed-card-meta">mastodonpy.readthedocs.io</div>
    </div>
  </a>
</div>


Mastadon.py is a python api client for mastadon that makes it easy to cross post to mastadon.

``` python
from mastodon import Mastodon

Mastodon.create_app(
    'pytooterapp',
    api_base_url = 'https://mastodon.social',
    to_file = 'pytooter_clientcred.secret'
)

from mastodon import Mastodon

mastodon = Mastodon(client_id = 'pytooter_clientcred.secret',)
mastodon.log_in(
    'my_login_email@example.com',
    'incrediblygoodpassword',
    to_file = 'pytooter_usercred.secret'
)

mastodon.toot('Tooting from Python using #mastodonpy !')
```

!!! note

    This post is a <a href="/thoughts/" class="wikilink" data-title="Thoughts" data-description="These are generally my thoughts on a web page or some sort of url, except a rare few don&#39;t have a link. These are dual published off of my..." data-date="2024-04-01">thought</a>. It's a short note that I make
    about someone else's content online <a href="/tags/thoughts/" class="hashtag-tag" data-tag="thoughts" data-count=2 data-reading-time=3 data-reading-time-text="3 minutes">#thoughts</a>
