Author Topic: Luup nog working in scene but URL works  (Read 317 times)

Offline dayfly

  • Sr. Newbie
  • *
  • Posts: 34
  • Karma: +9/-2
Luup nog working in scene but URL works
« on: March 24, 2018, 01:12:31 pm »
I am trying to stop a device witch needs a \ parameter at the end


This code runs the scene
luup.inet.wget("http://root:pass@192.168.1.101/axis-cgi/io/port.cgi?action=3:/")

This code is supposed to stop the scene
luup.inet.wget("http://root:pass@192.168.1.101/axis-cgi/io/port.cgi?action=3:\")

but the moment i execute it i get the message : failed to test code try again.

If i paste the url in a browser it works, looks like the luup code cant reconize the \

Anyone know how i can get this working ?

Offline rigpapa

  • Hero Member
  • *****
  • Posts: 528
  • Karma: +71/-1
Re: Luup nog working in scene but URL works
« Reply #1 on: March 24, 2018, 01:23:00 pm »
Change the single backslash \ to two \\. The \ on its own means escape the next character, so you're swallowing the quote that follows as part of the request, and then leaving an unterminated string, which causes the error.

You could also try changing the single \ to %5c, which is the URL-encoded version of that character.
Author of Reactor, DelayLight, SiteSensor, Rachio, Deus Ex Machina II, Intesis WMP Gateway, Auto Virtual Thermostat and VirtualSensor plugins. Vera Plus w/100+ Z-wave devices. Vera3 sandbox.

Offline dayfly

  • Sr. Newbie
  • *
  • Posts: 34
  • Karma: +9/-2
Re: Luup nog working in scene but URL works
« Reply #2 on: March 25, 2018, 06:18:38 am »
Change the single backslash \ to two \\. The \ on its own means escape the next character, so you're swallowing the quote that follows as part of the request, and then leaving an unterminated string, which causes the error.

You could also try changing the single \ to %5c, which is the URL-encoded version of that character.
Thank you!

Working perfectly