Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'int' object is not subscriptable #95

Open
insinfo opened this issue Oct 11, 2023 · 4 comments
Open

TypeError: 'int' object is not subscriptable #95

insinfo opened this issue Oct 11, 2023 · 4 comments

Comments

@insinfo
Copy link

insinfo commented Oct 11, 2023

I'm getting this error when trying to use mitmproxy2swagger

PS C:\MyDartProjects\new_sali\backend\doc\swagger>  pip install mitmproxy2swagger
Requirement already satisfied: mitmproxy2swagger in c:\python312\lib\site-packages (0.11.0)
Requirement already satisfied: json-stream<3.0.0,>=2.3.2 in c:\python312\lib\site-packages (from mitmproxy2swagger) (2.3.2)
Requirement already satisfied: mitmproxy<11.0.0,>=10.0.0 in c:\python312\lib\site-packages (from mitmproxy2swagger) (10.1.1)
Requirement already satisfied: ruamel.yaml<0.18.0,>=0.17.32 in c:\python312\lib\site-packages (from mitmproxy2swagger) (0.17.35)
Requirement already satisfied: json-stream-rs-tokenizer>=0.4.17 in c:\python312\lib\site-packages (from json-stream<3.0.0,>=2.3.2->mitmproxy2swagger) (0.4.25)
Requirement already satisfied: aioquic-mitmproxy<0.10,>=0.9.20 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (0.9.20.3)
Requirement already satisfied: asgiref<3.8,>=3.2.10 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (3.7.2)
Requirement already satisfied: Brotli<1.1,>=1.0 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (1.0.9)
Requirement already satisfied: certifi>=2019.9.11 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (2023.7.22)
Requirement already satisfied: cryptography<41.1,>=38.0 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (41.0.4)
Requirement already satisfied: flask<2.4,>=1.1.1 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (2.3.3)
Requirement already satisfied: h11<0.15,>=0.11 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (0.14.0)
Requirement already satisfied: h2<5,>=4.1 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (4.1.0)
Requirement already satisfied: hyperframe<7,>=6.0 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (6.0.1)
Requirement already satisfied: kaitaistruct<0.11,>=0.10 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (0.10)
Requirement already satisfied: ldap3<2.10,>=2.8 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (2.9.1)
Requirement already satisfied: mitmproxy-rs<0.4,>=0.3.6 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (0.3.11)
Requirement already satisfied: msgpack<1.1.0,>=1.0.0 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (1.0.7)
Requirement already satisfied: passlib<1.8,>=1.6.5 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (1.7.4)
Requirement already satisfied: protobuf<5,>=3.14 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (4.24.4)
Requirement already satisfied: pyOpenSSL<23.3,>=22.1 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (23.2.0)
Requirement already satisfied: pyparsing<3.2,>=2.4.2 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (3.1.1)
Requirement already satisfied: pyperclip<1.9,>=1.6.0 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (1.8.2)
Requirement already satisfied: sortedcontainers<2.5,>=2.3 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (2.4.0)
Requirement already satisfied: tornado<7,>=6.2 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (6.3.3)
Requirement already satisfied: urwid-mitmproxy<2.2,>=2.1.1 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (2.1.2.1)
Requirement already satisfied: wsproto<1.3,>=1.0 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (1.2.0)
Requirement already satisfied: publicsuffix2<3,>=2.20190812 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (2.20191221)
Requirement already satisfied: zstandard<0.22,>=0.11 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (0.21.0)
Requirement already satisfied: pydivert<2.2,>=2.0.3 in c:\python312\lib\site-packages (from mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (2.1.0)
Requirement already satisfied: ruamel.yaml.clib>=0.2.7 in c:\python312\lib\site-packages (from ruamel.yaml<0.18.0,>=0.17.32->mitmproxy2swagger) (0.2.8)
Requirement already satisfied: pylsqpack<0.4.0,>=0.3.3 in c:\python312\lib\site-packages (from aioquic-mitmproxy<0.10,>=0.9.20->mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (0.3.17)
Requirement already satisfied: cffi>=1.12 in c:\python312\lib\site-packages (from cryptography<41.1,>=38.0->mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (1.16.0)
Requirement already satisfied: Werkzeug>=2.3.7 in c:\python312\lib\site-packages (from flask<2.4,>=1.1.1->mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (3.0.0)
Requirement already satisfied: Jinja2>=3.1.2 in c:\python312\lib\site-packages (from flask<2.4,>=1.1.1->mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (3.1.2)
Requirement already satisfied: itsdangerous>=2.1.2 in c:\python312\lib\site-packages (from flask<2.4,>=1.1.1->mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (2.1.2)
Requirement already satisfied: click>=8.1.3 in c:\python312\lib\site-packages (from flask<2.4,>=1.1.1->mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (8.1.7)
Requirement already satisfied: blinker>=1.6.2 in c:\python312\lib\site-packages (from flask<2.4,>=1.1.1->mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (1.6.3)
Requirement already satisfied: hpack<5,>=4.0 in c:\python312\lib\site-packages (from h2<5,>=4.1->mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (4.0.0)
Requirement already satisfied: pyasn1>=0.4.6 in c:\python312\lib\site-packages (from ldap3<2.10,>=2.8->mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (0.5.0)
Requirement already satisfied: mitmproxy_windows==0.3.11 in c:\python312\lib\site-packages (from mitmproxy-rs<0.4,>=0.3.6->mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (0.3.11)
Requirement already satisfied: pycparser in c:\python312\lib\site-packages (from cffi>=1.12->cryptography<41.1,>=38.0->mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (2.21)
Requirement already satisfied: colorama in c:\python312\lib\site-packages (from click>=8.1.3->flask<2.4,>=1.1.1->mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (0.4.6)
Requirement already satisfied: MarkupSafe>=2.0 in c:\python312\lib\site-packages (from Jinja2>=3.1.2->flask<2.4,>=1.1.1->mitmproxy<11.0.0,>=10.0.0->mitmproxy2swagger) (2.1.3)
PS C:\MyDartProjects\new_sali\backend\doc\swagger> 



PS C:\MyDartProjects\new_sali\backend\doc\swagger> python --version
Python 3.12.0

PS C:\MyDartProjects\new_sali\backend\doc\swagger> mitmproxy2swagger -i .\flows -o ./out.yaml  -p http://localhost:3350/api/v1
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:\python312\Scripts\mitmproxy2swagger.exe\__main__.py", line 7, in <module>
  File "C:\python312\Lib\site-packages\mitmproxy2swagger\mitmproxy2swagger.py", line 178, in main
    for req in capture_reader.captured_requests():
  File "C:\python312\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
PS C:\MyDartProjects\new_sali\backend\doc\swagger> 

flows

3241:9:websocket;0:~8:response;1396:6:reason;2:OK,11:status_code;3:200#13:timestamp_end;18:1697032225.7566624^15:timestamp_start;18:1697032225.7546453^8:trailers;0:~7:content;856:{"accessToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImFub19leGVyY2ljaW8iOiIyMDIzIiwiYW5vX2V4ZXJjaWNpb19zZXRvciI6IjIwMDMiLCJjb2RfZGVwYXJ0YW1lbnRvIjoyLCJjb2Rfb3JnYW8iOjIsImNvZF9zZXRvciI6MSwiY29kX3VuaWRhZGUiOjg5LCJjcGYiOiIxMzEyODI1MDczMSIsImlkX3NldG9yIjo1MjQsIm5vbV9jZ20iOiJJc2FxdWUgTmV2ZXMgU2FudCdhbmEiLCJudW1jZ20iOjE0MDA1MCwidXNlcm5hbWUiOiJpc2FxdWUuc2FudGFuYSJ9LCJleHAiOjE2OTcwNjQ2MjUsImlhdCI6MTY5NzAzMjIyNSwiaXNzIjoibmV3c2FsaS5yaW9kYXNvc3RyYXMucmouZ292LmJyIiwibmJmIjoxNjk3MDMyMjI1fQ.wUxQI1alM0A3638c1Yx01Y3NgTttaK_3zrnYcVVZvuw","nom_cgm":"Isaque Neves Sant'ana","cpf":"13128250731","numcgm":140050,"username":"isaque.santana","ano_exercicio":"2023","cod_setor":1,"id_setor":524,"cod_orgao":2,"cod_unidade":89,"cod_departamento":2,"nom_setor":"TI - Tecnologia da Informação","expiry":"2023-10-11T19:50:25.738848","ano_exercicio_setor":"2003"},7:headers;354:40:4:date,29:Wed, 11 Oct 2023 13:50:25 GMT,]35:27:access-control-allow-origin,1:*,]31:17:transfer-encoding,7:chunked,]37:29:access-control-expose-headers,1:*,]33:15:x-frame-options,10:SAMEORIGIN,]51:12:content-type,31:application/json; charset=utf-8,]37:16:x-xss-protection,13:1; mode=block,]36:22:x-content-type-options,7:nosniff,]18:6:server,6:Angel3,]]12:http_version;8:HTTP/1.1,}7:request;650:4:path;18:/api/v1/auth/login,9:authority;0:,6:scheme;4:http,6:method;4:POST,4:port;4:3350#4:host;9:localhost;13:timestamp_end;17:1697032225.544109^15:timestamp_start;18:1697032225.5431092^8:trailers;0:~7:content;97:{
    "username": "isaque.santana",
    "password": "Ins257257",
    "anoExercicio": "2023"
},7:headers;295:36:12:Content-Type,16:application/json,]39:10:User-Agent,21:PostmanRuntime/7.33.0,]15:6:Accept,3:*/*,]57:13:Postman-Token,36:c05dd98c-acad-4ded-8773-800c07217fef,]25:4:Host,14:localhost:3350,]40:15:Accept-Encoding,17:gzip, deflate, br,]28:10:Connection,10:keep-alive,]23:14:Content-Length,2:97,]]12:http_version;8:HTTP/1.1,}6:backup;0:~17:timestamp_created;18:1697032225.5431092^7:comment;0:;8:metadata;0:}6:marked;0:;9:is_replay;0:~11:intercepted;5:false!11:server_conn;469:3:via;0:~19:timestamp_tcp_setup;16:1697032225.55111^7:address;19:9:localhost;4:3350#]19:timestamp_tls_setup;0:~13:timestamp_end;17:1697032478.893024^15:timestamp_start;18:1697032225.5461097^3:sni;0:~11:tls_version;0:~11:cipher_list;0:]6:cipher;0:~11:alpn_offers;0:]4:alpn;0:~16:certificate_list;0:]3:tls;5:false!5:error;0:~18:transport_protocol;3:tcp;2:id;36:baac6dca-5915-47e3-a56f-476efb33582a;8:sockname;22:3:::1;5:22274#1:0#1:0#]8:peername;21:3:::1;4:3350#1:0#1:0#]}11:client_conn;422:10:proxy_mode;7:regular;8:mitmcert;0:~19:timestamp_tls_setup;0:~13:timestamp_end;18:1697033078.8951516^15:timestamp_start;17:1697032225.540111^3:sni;0:~11:tls_version;0:~11:cipher_list;0:]6:cipher;0:~11:alpn_offers;0:]4:alpn;0:~16:certificate_list;0:]3:tls;5:false!5:error;0:~18:transport_protocol;3:tcp;2:id;36:bbe98b4a-9ed6-4457-9fd3-e94cca252722;8:sockname;21:3:::1;4:8080#1:0#1:0#]8:peername;22:3:::1;5:22273#1:0#1:0#]}5:error;0:~2:id;36:26224f55-7ab1-438e-94b7-98b73e7b793c;4:type;4:http;7:version;2:20#}3790:9:websocket;0:~8:response;1536:6:reason;2:OK,11:status_code;3:200#13:timestamp_end;18:1697032303.2793176^15:timestamp_start;18:1697032303.2773159^8:trailers;0:~7:content;996:{"cod_processo":8,"ano_exercicio":"2004","cod_classificacao":40,"cod_assunto":2,"numcgm":699,"cod_usuario":161,"cod_situacao":11,"timestamp":"2004-01-05T10:27:24.229Z","observacoes":"","confidencial":true,"resumo_assunto":"","id_setor":null,"atributosProtocolo":[{"cod_atributo":1,"nom_atributo":"Anotações","tipo":"t","valor_padrao":"","cod_assunto":2,"cod_classificacao":40,"cod_processo":8,"exercicio":"2004","valor":""},{"cod_atributo":2,"nom_atributo":"Referência Anterior","tipo":"t","valor_padrao":"","cod_assunto":2,"cod_classificacao":40,"cod_processo":8,"exercicio":"2004","valor":""}],"cgm_interessado":699,"nome_interessado":"NAIR IVETE DOS REIS","codigo_processo":"8/2004","nom_classificacao":"Férias","nom_assunto":"Férias","nom_situacao":"Arquivado férias","usuario_que_incluiu":"dbertin","nome_usuario_que_incluiu":"DENIZE MOREIRA DE AZEVEDO BERTIN","cod_ultimo_andamento":9,"tipo_interessado":"i","timestamp_arquivamento":"2004-02-03T14:47:59.131Z","texto_complementar":""},7:headers;354:40:4:date,29:Wed, 11 Oct 2023 13:51:43 GMT,]35:27:access-control-allow-origin,1:*,]31:17:transfer-encoding,7:chunked,]37:29:access-control-expose-headers,1:*,]33:15:x-frame-options,10:SAMEORIGIN,]51:12:content-type,31:application/json; charset=utf-8,]37:16:x-xss-protection,13:1; mode=block,]36:22:x-content-type-options,7:nosniff,]18:6:server,6:Angel3,]]12:http_version;8:HTTP/1.1,}7:request;1058:4:path;34:/api/v1/protocolo/processos/2004/8,9:authority;0:,6:scheme;4:http,6:method;3:GET,4:port;4:3350#4:host;9:localhost;13:timestamp_end;18:1697032302.8685155^15:timestamp_start;18:1697032302.8675468^8:trailers;0:~7:content;0:,7:headers;785:552:13:Authorization,530:Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImFub19leGVyY2ljaW8iOiIyMDIzIiwiYW5vX2V4ZXJjaWNpb19zZXRvciI6IjIwMDMiLCJjb2RfZGVwYXJ0YW1lbnRvIjoyLCJjb2Rfb3JnYW8iOjIsImNvZF9zZXRvciI6MSwiY29kX3VuaWRhZGUiOjg5LCJjcGYiOiIxMzEyODI1MDczMSIsImlkX3NldG9yIjo1MjQsIm5vbV9jZ20iOiJJc2FxdWUgTmV2ZXMgU2FudCdhbmEiLCJudW1jZ20iOjE0MDA1MCwidXNlcm5hbWUiOiJpc2FxdWUuc2FudGFuYSJ9LCJleHAiOjE2OTcwNjQ2MjUsImlhdCI6MTY5NzAzMjIyNSwiaXNzIjoibmV3c2FsaS5yaW9kYXNvc3RyYXMucmouZ292LmJyIiwibmJmIjoxNjk3MDMyMjI1fQ.wUxQI1alM0A3638c1Yx01Y3NgTttaK_3zrnYcVVZvuw,]39:10:User-Agent,21:PostmanRuntime/7.33.0,]15:6:Accept,3:*/*,]57:13:Postman-Token,36:4ef7fd28-f0a2-416a-a320-a6cfaa19d768,]25:4:Host,14:localhost:3350,]40:15:Accept-Encoding,17:gzip, deflate, br,]28:10:Connection,10:keep-alive,]]12:http_version;8:HTTP/1.1,}6:backup;0:~17:timestamp_created;18:1697032302.8675468^7:comment;0:;8:metadata;0:}6:marked;0:;9:is_replay;0:~11:intercepted;5:false!11:server_conn;469:3:via;0:~19:timestamp_tcp_setup;16:1697032225.55111^7:address;19:9:localhost;4:3350#]19:timestamp_tls_setup;0:~13:timestamp_end;17:1697032478.893024^15:timestamp_start;18:1697032225.5461097^3:sni;0:~11:tls_version;0:~11:cipher_list;0:]6:cipher;0:~11:alpn_offers;0:]4:alpn;0:~16:certificate_list;0:]3:tls;5:false!5:error;0:~18:transport_protocol;3:tcp;2:id;36:baac6dca-5915-47e3-a56f-476efb33582a;8:sockname;22:3:::1;5:22274#1:0#1:0#]8:peername;21:3:::1;4:3350#1:0#1:0#]}11:client_conn;422:10:proxy_mode;7:regular;8:mitmcert;0:~19:timestamp_tls_setup;0:~13:timestamp_end;18:1697033078.8951516^15:timestamp_start;17:1697032225.540111^3:sni;0:~11:tls_version;0:~11:cipher_list;0:]6:cipher;0:~11:alpn_offers;0:]4:alpn;0:~16:certificate_list;0:]3:tls;5:false!5:error;0:~18:transport_protocol;3:tcp;2:id;36:bbe98b4a-9ed6-4457-9fd3-e94cca252722;8:sockname;21:3:::1;4:8080#1:0#1:0#]8:peername;22:3:::1;5:22273#1:0#1:0#]}5:error;0:~2:id;36:4f315173-0f66-409f-94d5-47f027db1c4b;4:type;4:http;7:version;2:20#}7245:9:websocket;0:~8:response;5016:6:reason;2:OK,11:status_code;3:200#13:timestamp_end;18:1697033236.1156993^15:timestamp_start;18:1697033236.1140969^8:trailers;0:~7:content;4450:{"totalRecords":9,"error":"","items":[{"processo":"8/2004","data_andamento":"2019-03-22T00:00:00.000Z","nome_cgm_andamento":"Administrador","nome_setor_destino":"SEMAD/SUBGEP - Subsecretaria Municipal de Gestão de Pessoas","data_recebimento":"2019-03-22T00:00:00.000Z","nome_cgm_recebimento":"Administrador","cod_andamento":9,"cod_processo":8,"ano_exercicio":"2004","cod_orgao":2,"cod_unidade":88,"cod_departamento":1,"cod_setor":1,"ano_exercicio_setor":"2003","cod_usuario":0,"timestamp":"2019-03-22T00:00:00.000Z","despachos":[]},{"processo":"8/2004","data_andamento":"2013-01-02T00:00:00.000Z","nome_cgm_andamento":"Administrador","nome_setor_destino":"Subsec.Mun.Gestão Pessoas e Segurança no Amb.Trabalho","data_recebimento":"2013-01-02T00:00:00.000Z","nome_cgm_recebimento":"Administrador","cod_andamento":8,"cod_processo":8,"ano_exercicio":"2004","cod_orgao":2,"cod_unidade":58,"cod_departamento":1,"cod_setor":1,"ano_exercicio_setor":"2003","cod_usuario":0,"timestamp":"2013-01-02T00:00:00.000Z","despachos":[]},{"processo":"8/2004","data_andamento":"2012-03-23T07:00:00.000Z","nome_cgm_andamento":"Administrador","nome_setor_destino":"SEMGEP - Secretaria Municipal de Gestão de Pessoas","data_recebimento":"2012-03-23T07:00:00.000Z","nome_cgm_recebimento":"Administrador","cod_andamento":7,"cod_processo":8,"ano_exercicio":"2004","cod_orgao":2,"cod_unidade":27,"cod_departamento":1,"cod_setor":1,"ano_exercicio_setor":"2003","cod_usuario":0,"timestamp":"2012-03-23T07:00:00.000Z","despachos":[]},{"processo":"8/2004","data_andamento":"2004-02-03T14:34:37.465Z","nome_cgm_andamento":"DICOP - SEMAD","nome_setor_destino":"DERHU - Depto. de Recursos Humanos","data_recebimento":"2004-02-03T14:47:59.131Z","nome_cgm_recebimento":"CARLOS OTÁVIO FERNANDES TAVARES","cod_andamento":6,"cod_processo":8,"ano_exercicio":"2004","cod_orgao":2,"cod_unidade":5,"cod_departamento":2,"cod_setor":4,"ano_exercicio_setor":"2003","cod_usuario":1722,"timestamp":"2004-02-03T14:34:37.465Z","despachos":[]},{"processo":"8/2004","data_andamento":"2004-01-28T10:53:48.760Z","nome_cgm_andamento":"CARLOS OTÁVIO FERNANDES TAVARES","nome_setor_destino":"DICOP - Div. de Controle de Pessoal","data_recebimento":"2004-02-03T14:06:55.356Z","nome_cgm_recebimento":"DICOP - SEMAD","cod_andamento":5,"cod_processo":8,"ano_exercicio":"2004","cod_orgao":2,"cod_unidade":5,"cod_departamento":2,"cod_setor":3,"ano_exercicio_setor":"2003","cod_usuario":1766,"timestamp":"2004-01-28T10:53:48.760Z","despachos":[]},{"processo":"8/2004","data_andamento":"2004-01-13T16:34:14.302Z","nome_cgm_andamento":"ROSILEA AGUIAR VON RANDOW","nome_setor_destino":"DERHU - Depto. de Recursos Humanos","data_recebimento":"2004-01-16T11:20:59.936Z","nome_cgm_recebimento":"NELITO SENRA ESTERQUE","cod_andamento":4,"cod_processo":8,"ano_exercicio":"2004","cod_orgao":2,"cod_unidade":5,"cod_departamento":2,"cod_setor":4,"ano_exercicio_setor":"2003","cod_usuario":1395,"timestamp":"2004-01-13T16:34:14.302Z","despachos":[]},{"processo":"8/2004","data_andamento":"2004-01-13T10:48:03.576Z","nome_cgm_andamento":"NELITO SENRA ESTERQUE","nome_setor_destino":"SEMAD - Secretaria Municipal de Administração","data_recebimento":"2004-01-13T15:40:58.892Z","nome_cgm_recebimento":"ROSILEA AGUIAR VON RANDOW","cod_andamento":3,"cod_processo":8,"ano_exercicio":"2004","cod_orgao":2,"cod_unidade":5,"cod_departamento":1,"cod_setor":1,"ano_exercicio_setor":"2003","cod_usuario":1363,"timestamp":"2004-01-13T10:48:03.576Z","despachos":[]},{"processo":"8/2004","data_andamento":"2004-01-06T13:30:00.000Z","nome_cgm_andamento":"SEMAD","nome_setor_destino":"DERHU - Depto. de Recursos Humanos","data_recebimento":"2004-01-13T10:25:57.410Z","nome_cgm_recebimento":"NELITO SENRA ESTERQUE","cod_andamento":2,"cod_processo":8,"ano_exercicio":"2004","cod_orgao":2,"cod_unidade":5,"cod_departamento":2,"cod_setor":4,"ano_exercicio_setor":"2003","cod_usuario":327,"timestamp":"2004-01-06T13:30:00.000Z","despachos":[]},{"processo":"8/2004","data_andamento":"2004-01-05T10:27:24.229Z","nome_cgm_andamento":"DENIZE MOREIRA DE AZEVEDO BERTIN","nome_setor_destino":"SEMAD - Secretaria Municipal de Administração","data_recebimento":"2004-01-06T10:40:00.000Z","nome_cgm_recebimento":"SEMAD","cod_andamento":1,"cod_processo":8,"ano_exercicio":"2004","cod_orgao":2,"cod_unidade":5,"cod_departamento":1,"cod_setor":1,"ano_exercicio_setor":"2003","cod_usuario":161,"timestamp":"2004-01-05T10:27:24.229Z","despachos":[]}]},7:headers;379:21:13:total-records,1:9,]40:4:date,29:Wed, 11 Oct 2023 14:07:16 GMT,]35:27:access-control-allow-origin,1:*,]31:17:transfer-encoding,7:chunked,]37:29:access-control-expose-headers,1:*,]33:15:x-frame-options,10:SAMEORIGIN,]51:12:content-type,31:application/json; charset=utf-8,]37:16:x-xss-protection,13:1; mode=block,]36:22:x-content-type-options,7:nosniff,]18:6:server,6:Angel3,]]12:http_version;8:HTTP/1.1,}7:request;1068:4:path;45:/api/v1/protocolo/processos/andamentos/2004/8,9:authority;0:,6:scheme;4:http,6:method;3:GET,4:port;4:3350#4:host;9:localhost;13:timestamp_end;18:1697033235.8782544^15:timestamp_start;17:1697033235.877251^8:trailers;0:~7:content;0:,7:headers;785:552:13:Authorization,530:Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImFub19leGVyY2ljaW8iOiIyMDIzIiwiYW5vX2V4ZXJjaWNpb19zZXRvciI6IjIwMDMiLCJjb2RfZGVwYXJ0YW1lbnRvIjoyLCJjb2Rfb3JnYW8iOjIsImNvZF9zZXRvciI6MSwiY29kX3VuaWRhZGUiOjg5LCJjcGYiOiIxMzEyODI1MDczMSIsImlkX3NldG9yIjo1MjQsIm5vbV9jZ20iOiJJc2FxdWUgTmV2ZXMgU2FudCdhbmEiLCJudW1jZ20iOjE0MDA1MCwidXNlcm5hbWUiOiJpc2FxdWUuc2FudGFuYSJ9LCJleHAiOjE2OTcwNjQ2MjUsImlhdCI6MTY5NzAzMjIyNSwiaXNzIjoibmV3c2FsaS5yaW9kYXNvc3RyYXMucmouZ292LmJyIiwibmJmIjoxNjk3MDMyMjI1fQ.wUxQI1alM0A3638c1Yx01Y3NgTttaK_3zrnYcVVZvuw,]39:10:User-Agent,21:PostmanRuntime/7.33.0,]15:6:Accept,3:*/*,]57:13:Postman-Token,36:d8c5aa10-aa89-4ddb-850f-71c5a83de450,]25:4:Host,14:localhost:3350,]40:15:Accept-Encoding,17:gzip, deflate, br,]28:10:Connection,10:keep-alive,]]12:http_version;8:HTTP/1.1,}6:backup;0:~17:timestamp_created;18:1697033235.8782544^7:comment;0:;8:metadata;0:}6:marked;0:;9:is_replay;0:~11:intercepted;5:false!11:server_conn;452:3:via;0:~19:timestamp_tcp_setup;17:1697033235.881254^7:address;19:9:localhost;4:3350#]19:timestamp_tls_setup;0:~13:timestamp_end;0:~15:timestamp_start;18:1697033235.8802545^3:sni;0:~11:tls_version;0:~11:cipher_list;0:]6:cipher;0:~11:alpn_offers;0:]4:alpn;0:~16:certificate_list;0:]3:tls;5:false!5:error;0:~18:transport_protocol;3:tcp;2:id;36:fd206318-8a05-4393-8f84-888e73c41f85;8:sockname;22:3:::1;5:22820#1:0#1:0#]8:peername;21:3:::1;4:3350#1:0#1:0#]}11:client_conn;404:10:proxy_mode;7:regular;8:mitmcert;0:~19:timestamp_tls_setup;0:~13:timestamp_end;0:~15:timestamp_start;18:1697033235.8762827^3:sni;0:~11:tls_version;0:~11:cipher_list;0:]6:cipher;0:~11:alpn_offers;0:]4:alpn;0:~16:certificate_list;0:]3:tls;5:false!5:error;0:~18:transport_protocol;3:tcp;2:id;36:20cead20-c90c-4be7-8e5c-360a3bc8d8b4;8:sockname;21:3:::1;4:8080#1:0#1:0#]8:peername;22:3:::1;5:22819#1:0#1:0#]}5:error;0:~2:id;36:84ab3d64-c2e0-419e-837d-8116a73a6044;4:type;4:http;7:version;2:20#}
@qjoly
Copy link

qjoly commented Oct 27, 2023

Hi,

I have the same error, I tried multiple version of Python (3.8, 3.10 and 3.11).

test git:(master) ✗ mitmproxy2swagger -i ./flow -p "http://192.168.1.21" -o test.yaml
No existing swagger file found. Creating new one.
Traceback (most recent call last):
  File "/home/qjoly01/.local/bin/mitmproxy2swagger", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/qjoly01/.local/lib/python3.11/site-packages/mitmproxy2swagger/mitmproxy2swagger.py", line 178, in main
    for req in capture_reader.captured_requests():
  File "/home/qjoly01/.local/lib/python3.11/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

@tikolakin
Copy link

Same issue. Any hints to troubleshoot would be much appreciated.
Thanks

@insinfo
Copy link
Author

insinfo commented Nov 6, 2023

I solved the problem for me by passing the "-f flow" argument

mitmproxy2swagger -i .\flows -o ./out.yaml -p http://localhost:3350/api/v1 -f flow

@CyberYeagerist
Copy link

Not in my case
image

@whosflashy
Copy link

Anyone find a fix for this yet? None of the ones listed above fixed it for me
image
stuck like this when i use -f flow

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants