mitmproxy2swagger icon indicating copy to clipboard operation
mitmproxy2swagger copied to clipboard

Error when parsing flow files

Open MqtUA opened this issue 7 months ago • 6 comments

mitmproxy2swagger -i flows(3) -o spec.yml -p https://target-api/api/
No existing swagger file found. Creating new one.
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "C:\Users\Maks\miniconda3\Scripts\mitmproxy2swagger.exe\__main__.py", line 7, in <module>
  File "C:\Users\Maks\miniconda3\Lib\site-packages\mitmproxy2swagger\mitmproxy2swagger.py", line 179, in main
    for req in capture_reader.captured_requests():
  File "C:\Users\Maks\miniconda3\Lib\site-packages\mitmproxy2swagger\har_capture_reader.py", line 117, in captured_requests
    for entry in data["log"]["entries"].persistent():
                 ~~~~^^^^^^^
TypeError: 'int' object is not subscriptable

I am on I am on Windows 11 if that matters. Pasing har files works good

MqtUA avatar May 22 '25 21:05 MqtUA

upd. second run for har parsing also fails

MqtUA avatar May 24 '25 22:05 MqtUA

Can you try the solution I proposed in #215? Afterwards try using flag -f flow when executing. Both should work. This could possibly confirm my fix.

kristiandueholm avatar May 25 '25 18:05 kristiandueholm

-f flow helped, thank you

MqtUA avatar May 28 '25 19:05 MqtUA

-f flow helped, thank you

Do you mind cloning the fork in #215 and running it clean again without -f flow? This will help confirm my proposed fix.

kristiandueholm avatar May 29 '25 09:05 kristiandueholm

@kristiandueholm your patch fixes the issue for me.

frafra avatar Aug 01 '25 11:08 frafra

@kristiandueholm your patch fixes the issue for me.

Cool! I have not been able to get in contact with @alufers though.

kristiandueholm avatar Aug 01 '25 13:08 kristiandueholm