Skip to content

Commit

Permalink
Added custom API calls, modified to allow tokens to be set
Browse files Browse the repository at this point in the history
  • Loading branch information
YuzuRyo61 committed Jun 3, 2024
1 parent 669e1dc commit e97a974
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions misskey/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ def address(self) -> str:
@property
def token(self) -> Optional[str]:
return self._token

@token.setter
def token(self, value: str) -> None:
self._token = value

def __init__(
self, *,
Expand Down Expand Up @@ -60,3 +64,10 @@ def _api_request(
**kwargs
) -> Any:
raise NotImplementedError()

def api_call(
self, *,
endpoint: str,
**kwargs
) -> Any:
raise NotImplementedError()
11 changes: 11 additions & 0 deletions misskey/sync_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ def __init__(
self.session = requests.Session()
else:
self.session = session

def api_call(
self, *,
endpoint: str,
**kwargs
) -> Any:
return self._api_request(
method=HttpMethodEnum.POST,
endpoint="/api/" + endpoint,
params=kwargs
)

def _api_request(
self, *,
Expand Down

0 comments on commit e97a974

Please sign in to comment.