Closed laolyu closed 2 months ago
The issue is with the POST
request to https://zlgcxy.jw.chaoxing.com/admin/login
. There is no text
field in the postData
of that request, only params
, so the value used in the template is empty and breaks the syntax.
The draft HAR spec does specify that "...text and params fields are mutually exclusive.", although all the tools I've used so far generate both fields when possible.
If there are URL encoded params but no text
field, it could be generated to support this type of unusual but valid HAR files.
har2locust --loglevel DEBUG zlxy.har > ab.py
ERROR:root:invalid syntax when parsing rendered template Traceback (most recent call last): File "", line 198, in _run_module_as_main
File "", line 88, in _run_code
File "C:\Users\aihole\AppData\Local\Programs\Python\Python311\Scripts\har2locust.exe__main.py", line 7, in
File "c:\users\aihole\appdata\local\programs\python\python311\Lib\site-packages\har2locust__main.py", line 31, in main__
py = render(args.template, template_values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\users\aihole\appdata\local\programs\python\python311\Lib\site-packages\har2locust\ main__.py", line 103, in render
tree = ast.parse(py, type_comments=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "c:\users\aihole\appdata\local\programs\python\python311\Lib\ast.py", line 50, in parse
return compile(source, filename, mode, flags,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "", line 142
'sec-ch-ua-platform': '"Windows"',}, data=,catch_response=True) as resp:
^
SyntaxError: invalid syntax
C:\Users\aihole\Desktop>har2locust -V har2locust 0.9.3 C:\Users\aihole\Desktop>har2locust --loglevel DEBUG zlxy.har > ab.py zlxy.zip