Fixed up JSON API key names
This commit is contained in:
parent
8b0f00dc4b
commit
0ce3d4de2a
2 changed files with 5 additions and 4 deletions
|
@ -77,6 +77,7 @@ from fastapi import FastAPI, Header
|
|||
#+end_src
|
||||
|
||||
** Pretty print and usage printer
|
||||
Pretty print so output is legible.
|
||||
#+begin_src python
|
||||
pp = pp.Printer = pprint.PrettyPrinter(indent=2, compact=True)
|
||||
|
||||
|
@ -108,10 +109,10 @@ async def api_get(k: int = Header(default=None)):
|
|||
return {"message": "Header k must be an integer between 6 and 100 inclusive or not present."}
|
||||
if k is None:
|
||||
result = one_turn_table(100)
|
||||
return {"Probabilities of throwing the highest number on dice of size": result}
|
||||
return {"Probabilities-dice": result}
|
||||
elif k >= 6 and k <= 100:
|
||||
result = one_turn_single(k)
|
||||
return {f"Probability of throwing the highest number of dice of size {k}": result}
|
||||
return {f"Probability-dice-size-{k}": result}
|
||||
else:
|
||||
return {"message": "Usage: no request body, use header k to specify what probability you want, if no k, then a table is given between dice sizes 6 and 100 inclusive."}
|
||||
|
||||
|
|
|
@ -26,10 +26,10 @@ async def api_get(k: int = Header(default=None)):
|
|||
return {"message": "Header k must be an integer between 6 and 100 inclusive or not present."}
|
||||
if k is None:
|
||||
result = one_turn_table(100)
|
||||
return {"Probabilities of throwing the highest number on dice of size": result}
|
||||
return {"Probabilities-dice": result}
|
||||
elif k >= 6 and k <= 100:
|
||||
result = one_turn_single(k)
|
||||
return {f"Probability of throwing the highest number of dice of size {k}": result}
|
||||
return {f"Probability-dice-size-{k}": result}
|
||||
else:
|
||||
return {"message": "Usage: no request body, use header k to specify what probability you want, if no k, then a table is given between dice sizes 6 and 100 inclusive."}
|
||||
|
||||
|
|
Loading…
Reference in a new issue