pklaus / brother_ql_web

A Python-based web service to print labels on Brother QL label printers. Based on brother_ql: https://github.com/pklaus/brother_ql
GNU General Public License v3.0
260 stars 127 forks source link

Can't get the API to work #50

Closed Maaaaarc closed 1 month ago

Maaaaarc commented 1 month ago

Since I am not really experienced with this stuff, there may be a simple Solution, but when I try to use this API URL: http://192.168.178.73:8013/api/print/text?text=Your_Text&font_size=100 or similar I get the following text:

 Error: 500 Internal Server Error
Sorry, the requested URL 'http://192.168.178.73:8013/api/print/text?text=Your_Text&font_size=100' caused an error:

Internal Server Error

Why is this and am I doing something wrong?

Thanks in advance.

FriedrichFroebel commented 1 month ago

Did you have a look at the server-side logs? It looks like the server-side raised an exception which should be visible there.

The most likely reason is that https://github.com/pklaus/brother_ql_web/blob/9e20b6dc3f80589bffc0b1036aa3f7122ea4af89/brother_ql_web.py#L56 fails due to the missing font specification. You should add a font parameter like &font_family=Roboto%20(Medium), assuming that you have the Roboto Medium font installed on your device.

Maaaaarc commented 1 month ago

Ohh 🤦‍♂️ it worked when I defined the font.

Since I hadn't installed the font used in the example, I thought I could just let it be undefined and the API uses the default one. I sincerely struggled for at least an hour with this because I thought it must be another error.

Thanks a lot for your quick reply, maybe another person like me will find this thread helpful.