Package: tweepy-mastodon
🐘 tweepy-mastodon: Mastodon API library with Tweepy interface for Python⚠ This library is under development! Only partial features are implemented.An attempt to provide Mastodon API library with Tweepy-like interface, to help developers to migrate their good bot/service built with Tweepy to Mastodon easily.Implemented APIAPIImplemented?Notetweepy.OAuth1UserHandler(previouslytweepy.OAuthHandler)✅api.verify_credentials()✅api.update_status()✅partially implementedapi.media_upload()✅partially implemented / video not supportedapi.destroy_status()✅partially implementedapi.home_timeline()✅partially implementedapi.get_user()✅partially implementedapi.user_timeline()✅partially implementedapi.get_status()✅partially implementedapi.create_favorite()✅partially implementedapi.destroy_favorite()✅partially implementedapi.retweet()✅partially implementedapi.unretweet()✅partially implementedapi.create_friendship()(a.k.a. follow)✅api.destroy_friendship()(a.k.a. unfollow)✅api.create_mute()✅api.destroy_mute()✅api.create_block()✅partially implementedapi.destroy_block()✅partially implementedapi.create_list()📝 TODOapi.destroy_list()📝 TODO...📝 TODOapi.mastodon✅Bonus: You can use any Mastodon.py API ✨Example usagePlease prepare your Mastodon API credentials from the developer settings page (example URL:https://mastodon.social/settings/applications).importdatetimeimporttweepy_mastodonastweepyapi_base_url='mastodon.social'mastodon_client_id='xxxxxxx'mastodon_client_secret='xxxxxxx'mastodon_access_token='xxxxxxx'auth=tweepy.OAuth1UserHandler(consumer_key=mastodon_client_id,consumer_secret=mastodon_client_secret,api_base_url=api_base_url)auth.set_access_token(mastodon_access_token)api=tweepy.API(auth)me=api.verify_credentials()assertme.screen_name=='shuuji3'assertme.display_name=='TAKAHASHI Shuuji 🌈✨'assertme.url=='https://shuuji3.xyz'assertme.profile_background_image_url=='https://files.mastodon.social/accounts/headers/000/936/436/original/4d6989a698953e80.jpg'assertme.created_at==datetime.datetime(2019,10,8,0,0,tzinfo=datetime.timezone.utc)assertme.avatar=='https://files.mastodon.social/accounts/avatars/000/936/436/original/4854d6cf9e12cb8f.png'assertme.favorited==Falseassertme.retweeted==Falseassertme.status.source=='<a href="https://elk.zone" rel="nofollow">Elk</a>'user=api.get_user(user_id=1)assertuser.id_str=='1'assertuser.screen_name=='Gargron'assertuser.name=='Eugen Rochko'user=api.get_user(screen_name='npr@mstdn.social')assertuser.id==1201325assertuser.screen_name=='NPR@mstdn.social'assertuser.name=='NPR :verified:'user_statuses=api.user_timeline(user_id=1,since_id=0,count=10)assertlen(user_statuses)==10status_id=109813536848077879# ref. https://mastodon.social/@shuuji3/109813536848077879status=api.get_status(id=status_id)assertstatus.user.screen_name=='shuuji3'assert'Hello from tweepy-mastodon!'instatus.textstatus=api.create_favorite(id=status_id)assertstatus.favoritedInstallationThe easiest way to install the latest version from PyPI is by usingpip:pip install tweepy-mastodonYou can also use Git to clone the repository from GitHub to install the latest
development version:git clone https://github.com/shuuji3/tweepy-mastodon.git
cd tweepy-mastodon
pip install .Alternatively, install directly from the GitHub repository:pip install git+https://github.com/shuuji3/tweepy-mastodon.gitPython 3.7 - 3.11 are supported.Linkstweepy-mastodon Documentation(TODO: update)Tweepy Documentationhalcy/Mastodon.py: Python wrapper for the Mastodon APITwitter API Documentation