diff --git a/README.md b/README.md index 21e8eab..7aa1bea 100644 --- a/README.md +++ b/README.md @@ -91,9 +91,11 @@ $ MICROBLOGPUB_DEBUG=1 FLASK_APP=app.py flask run -p 5005 --with-threads The user API is used by the admin UI (and requires a CSRF token when used with a regular user session), but it can also be accessed with an API key. +All the examples are using [HTTPie](https://httpie.org/). + ### POST /api/note/delete{?id} -Delete the given note `id`. +Deletes the given note `id`. Answers a **201** (Created) status code. diff --git a/activitypub.py b/activitypub.py index b63af90..1534a78 100644 --- a/activitypub.py +++ b/activitypub.py @@ -975,12 +975,13 @@ def parse_activity(payload: ObjectType, expected: Optional[ActivityType] = None) raise UnexpectedActivityTypeError(f'expected a {expected.name} activity, got a {payload["type"]}') if t not in _ACTIVITY_TYPE_TO_CLS: - raise BadActivityTypeError(f'unsupported activity type {payload["type"]}') + raise BadActivityError(f'unsupported activity type {payload["type"]}') activity = _ACTIVITY_TYPE_TO_CLS[t](**payload) return activity + def gen_feed(): fg = FeedGenerator() fg.id(f'{ID}') diff --git a/app.py b/app.py index 164e098..f305fa2 100644 --- a/app.py +++ b/app.py @@ -83,7 +83,7 @@ JWT_SECRET = get_secret_key('jwt') JWT = JSONWebSignatureSerializer(JWT_SECRET) def _admin_jwt_token() -> str: - return JWT.dumps({'me': 'ADMIN', 'ts': datetime.now().timestamp()}).decode('utf-8') + return JWT.dumps({'me': 'ADMIN', 'ts': datetime.now().timestamp()}).decode('utf-8') # type: ignore ADMIN_API_KEY = get_secret_key('admin_api_key', _admin_jwt_token)