Closed
Description
Versions
Key | Value |
---|---|
Package version | 1.0.8 (installed by pip) |
Python Version | 3.10 |
F@st Router Model | Speedport Pro |
Describe the bug
When trying to set a value in a xpath which contains a selector e.g. ""Device/UserInterface/LocalLEDSignaling/LEDs/LED[Name='LED_WLAN']/Enabled"
the response is:
sagemcom_api.exceptions.BadRequestException: <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>400 - Bad Request</title>
</head>
<body>
<h1>400 - Bad Request</h1>
<p>Invalid URL encoded format</p>
</body>
</html>
To Reproduce
Steps to reproduce the behavior:
- Call set_value_by_xpath with a xpath that contains a selector "some/xpath[Key='Value']" as shown in example above.
- The above error gets raised
Expected behavior
Set the value for the xpath without errors.
Screenshots
If applicable, add screenshots to help explain your problem.
Additional context
I noticed, that the get_value_by_xpath method uses "xpath": urllib.parse.quote(xpath), for each action, but the set_value method does not.
I fixed the problem by replacing "xpath": xpath, in the actions dict in set_value_by_xpath with "xpath": urllib.parse.quote(xpath), and it worked without any errors.
[bug]
Metadata
Metadata
Assignees
Labels
No labels