Can't POST to config_edit form - 418 "I'm a teapot"

Post a reply

Smilies
:D :) :( :o :shock: :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen:

BBCode is OFF
Smilies are ON

Topic review
   

Expand view Topic review: Can't POST to config_edit form - 418 "I'm a teapot"

Re: Can't POST to config_edit form - 418 "I'm a teapot"

by ogabrielluiz » Wed May 08, 2019 3:16 pm

Oh!
I knew it was the encoding but I couldn't even guess what was the right one.

Thanks!

Re: Can't POST to config_edit form - 418 "I'm a teapot"

by aka » Tue May 07, 2019 11:22 pm

'config.wtc' on disk is utf-16. Two bytes per symbol. 'Unicode' encoding in windows Notepad. Replace in your script:

Code: Select all

with open('config.wtc', 'w', encoding='utf-8') as f:
with

Code: Select all

with open('config.wtc', 'w', encoding='utf-16') as f:

Re: Can't POST to config_edit form - 418 "I'm a teapot"

by ogabrielluiz » Mon May 06, 2019 3:59 pm

ogabrielluiz wrote: Mon May 06, 2019 2:49 pm I was able to do it by creating a config.wtc file and uploading it through the upload_config_file form.

I'm having trouble now with encoding. For some reason when I upload the file I get this in the config_edit page:

Code: Select all

癲牥ㄽ㈹㌮㜶ㄮ㈹ †戠灰ㄽਸ਼††畴湲景浦湥㵵污慷獹‬獭㩧∠杁慵摲湡潤琠捥慬⸮∮ †搠獩㵫獵੢††敫批慯摲瀽⵴牢 †挠湯敮瑣潩
I am encoding it to utf-8, passing the data as a multiline string like so:

Code: Select all

new_config = """server=192.367.192
    bpp=16
    turnoffmenu=always, msg: "Aguardando tecla..."
    disk=usb
    keyboard=pt-br
    connection"""
Do you want me to create another thread for this?
The python script
script.txt
(1.31 KiB) Downloaded 462 times

Re: Can't POST to config_edit form - 418 "I'm a teapot"

by ogabrielluiz » Mon May 06, 2019 2:49 pm

I was able to do it by creating a config.wtc file and uploading it through the upload_config_file form.

I'm having trouble now with encoding. For some reason when I upload the file I get this in the config_edit page:

Code: Select all

癲牥ㄽ㈹㌮㜶ㄮ㈹ †戠灰ㄽਸ਼††畴湲景浦湥㵵污慷獹‬獭㩧∠杁慵摲湡潤琠捥慬⸮∮ †搠獩㵫獵੢††敫批慯摲瀽⵴牢 †挠湯敮瑣潩
I am encoding it to utf-8, passing the data as a multiline string like so:

Code: Select all

new_config = """server=192.367.192
    bpp=16
    turnoffmenu=always, msg: "Aguardando tecla..."
    disk=usb
    keyboard=pt-br
    connection"""
Do you want me to create another thread for this?

Re: Can't POST to config_edit form - 418 "I'm a teapot"

by aka » Sat May 04, 2019 11:53 am

WTware http server is very trivial. We test it from IE/Chrome/Mozilla only.

What language is it? Write me full source file so i can test it on my stand.

Can't POST to config_edit form - 418 "I'm a teapot"

by ogabrielluiz » Fri May 03, 2019 4:02 pm

Hello!

Thanks for this awesome software.

I am trying to make a POST request to the form in config_edit but I'm getting the 418 "I'm a teapot" error.

I've tried POSTing the text directly and tried a multipart file giving "config.wtc" as the name.

Code: Select all

URL = "https://192.168.15.15/config_edit"
new_config_file = {"config_save":('config.wtc',"""server=192.367.192
                    bpp=16
                    turnoffmenu=always
                    disk=usb
                    keyboard=pt-br
                    connection""")}    
    
post = s.post(URL, auth=('', '123456'), files=new_config_file)
Or this using text instead of multipart:

Code: Select all

# Here I tried "config", "config_save", "config.wtc"
new_config = {"config_save":"""server=192.367.192 
                    bpp=16
                    turnoffmenu=always, msg: "Aguardando tecla..."
                    disk=usb
                    keyboard=pt-br
                    connection"""}
post = s.post(URL, auth=('', '123456'), data=new_config)
Can someone help me? I'm kinda new to this.

Thanks

Top