18 lines
318 B
Python
18 lines
318 B
Python
from typing import Annotated
|
|
|
|
from fastapi import Depends, Path, Request
|
|
|
|
from beamline import get_beamline
|
|
|
|
|
|
def beamline_dependency(request: Request) -> str:
|
|
return get_beamline(request.client.host)
|
|
|
|
Beamline = Annotated[str, Depends(beamline_dependency)]
|
|
|
|
|
|
PGroup = Annotated[str, Path(pattern=r"^p\d{5}$")]
|
|
|
|
|
|
|