mirror of
https://github.com/bellingcat/auto-archiver-api.git
synced 2026-06-10 12:38:35 +03:00
* Update pyproject.toml * add pre-commit * Create .pre-commit-config.yaml * Comment out ruff * Update .pre-commit-config.yaml * General formatting * Create format-and-fail.yml * Update ci.yml * Add pre-commit to dev dependencies * Update pyproject.toml
17 lines
387 B
Python
17 lines
387 B
Python
import base64
|
|
|
|
from fastapi.encoders import jsonable_encoder
|
|
|
|
|
|
def custom_jsonable_encoder(obj):
|
|
if isinstance(obj, bytes):
|
|
return base64.b64encode(obj).decode('utf-8')
|
|
return jsonable_encoder(obj)
|
|
|
|
|
|
def convert_priority_to_queue_dict(priority: str) -> dict:
|
|
return {
|
|
"priority": 0 if priority == "high" else 10,
|
|
"queue": f"{priority}_priority"
|
|
}
|