social media crossposting tool. 3rd time's the charm
mastodon
misskey
crossposting
bluesky
1from abc import ABC, abstractmethod
2
3import requests
4
5from cross.service import Service
6from util.util import LOGGER
7
8
9class MisskeyService(ABC, Service):
10 def verify_credentials(self):
11 responce = requests.post(
12 f"{self.url}/api/i",
13 json={"i": self._get_token()},
14 headers={"Content-Type": "application/json"},
15 )
16 if responce.status_code != 200:
17 LOGGER.error("Failed to validate user credentials!")
18 responce.raise_for_status()
19 return dict(responce.json())
20
21 @abstractmethod
22 def _get_token(self) -> str:
23 pass