Created
November 10, 2022 19:51
-
-
Save DeusFigendi/867308c3bfb144cc5a9bace81a9e8d1e to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python3 | |
from mastodon import Mastodon | |
from os.path import exists | |
# first run: | |
if (not(exists('pixelfed2galery.secrets'))): | |
Mastodon.create_app( | |
'pixelfed2galery', | |
api_base_url = 'https://troet.cafe', | |
scopes=['read', 'write'], | |
to_file = 'pixelfed2galery.secrets' | |
) | |
mastodon = Mastodon ( | |
client_id = 'pixelfed2galery.secrets', | |
) | |
print ('Mastodon version: ' + mastodon.retrieve_mastodon_version()) | |
else: | |
print('App allready registered') | |
mastodon = Mastodon ( | |
client_id = 'pixelfed2galery.secrets', | |
) | |
mastodon.access_token = mastodon.log_in ( | |
username = 'login@mailadress', | |
password = 'password', | |
scopes = ['read', 'write'] | |
) | |
# get the own account ID | |
own_account = mastodon.me() | |
print(own_account) | |
all_own_posts = mastodon.account_statuses(own_account, only_media=True, exclude_replies=True) | |
print(all_own_posts) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment