mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 13:14:28 +00:00
Fix type annotation and README
This commit is contained in:
parent
6aea610fb6
commit
48ab7137ab
3 changed files with 6 additions and 3 deletions
|
@ -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.
|
||||
|
||||
|
|
|
@ -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}')
|
||||
|
|
2
app.py
2
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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue