#🔒 Adding Outputs to my Code

9 messages · Page 1 of 1 (latest)

atomic tiger
#

Using Fast API


@app.get("/PackfotoTrigger/{auftragsnummer}")
def PackfotoErzeugung(auftragsnummer: str):

    ImageGrab()

    Image_Path = "//[IP]/Warenausgangsdokumentation/Documents/" + auftragsnummer + ".jpeg"

    #Original_Image = Image.open("./RecentPhoto/RawPhoto.jpeg") 
    #Rotated_Image = Original_Image.rotate(270)
    #Rotated_Image.save(Image_Path) 

    img = cv2.imread("./RecentPhoto/RawPhoto.jpeg")
    img_cw_90 = cv2.rotate(img, cv2.ROTATE_90_CLOCKWISE)
    cv2.imwrite(Image_Path, img_cw_90)

    return {"status":"200","message":"Bild erfolgreich gespeichert","path":"12345.jpg"}```

I hope someone can explain me, how i can add an output like this

```{
    "status": "200",
    "message": "Bild erfolgreich gespeichert",
    "path": "12345.jpg"
}```
grave wadiBOT
#

@atomic tiger

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

digital gulch
#

flask?

atomic tiger
#

oh sorry... Fast api

pure frigate
#

Also why are you putting the status in the json? The status code is already sent in the http response

grave wadiBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.