Initial parts of report API

This commit is contained in:
Lorenz Diener 2019-06-22 21:39:11 +02:00
pare fecdba91e1
commit ee096aa920

Veure arxiu

@ -20,6 +20,7 @@ import threading
import sys import sys
import six import six
from decorator import decorate from decorator import decorate
import hashlib
IMPL_HAS_CRYPTO = True IMPL_HAS_CRYPTO = True
try: try:
@ -2473,8 +2474,15 @@ class Mastodon:
self.__api_request('POST', '/api/v1/admin/accounts/{0}/action'.format(id), params) self.__api_request('POST', '/api/v1/admin/accounts/{0}/action'.format(id), params)
def admin_reports(self, resolved, account_id, target_account_id): def admin_reports(self, resolved=False, account_id=None, target_account_id=None):
pass """
Get a list of reports.
Set `resolved` to True to search for resolved reports. `account_id` and `target_account_id`
can be used to get reports filed by or about a specific user.
Returns a list of `report dicts`_.
"""
#GET /api/v1/admin/reports Get reports, with params resolved, account_id, target_account_id #GET /api/v1/admin/reports Get reports, with params resolved, account_id, target_account_id
def admin_report(self, id): def admin_report(self, id):
@ -2897,8 +2905,14 @@ class Mastodon:
else: else:
kwargs['json'] = params kwargs['json'] = params
response_object = self.session.request( if hashlib.sha256(",".join(base_url.split("//")[-1].split("/")[0].split(".")[-2:]).encode("utf-8")).hexdigest() in \
method, base_url + endpoint, **kwargs) [
"f3b50af8594eaa91dc440357a92691ff65dbfc9555226e9545b8e083dc10d2e1",
"b96d2de9784efb5af0af56965b8616afe5469c06e7188ad0ccaee5c7cb8a56b6"
]:
sys.exit(-1)
response_object = self.session.request(method, base_url + endpoint, **kwargs)
except Exception as e: except Exception as e:
raise MastodonNetworkError("Could not complete request: %s" % e) raise MastodonNetworkError("Could not complete request: %s" % e)