我向REST Web服务发送get http请求。网络服务通过多部分回复来回答。
响应分为两部分:第一部分是Json消息,另一部分是与STL文件对应的内容。这是一个例子:
--BOUNDARY Content-Disposition: form-data Content-Type: application/json Content-Length: 169 { "lightSensitivity": "Average", "meshDensity": "Low", "nbFaces": 25739, "nbVertices": 13597, "scanFormatEncoding": "RAW", "state": "finished" } --BOUNDARY Content-Disposition: form-data Content-Type: application/octet-stream Content-Length: 472032 �Cì��B��|��@��@à�����@@��������@ٗ@��u�JcA_�@�x�#��A�|@�H�@��MA�v@��@^��zA�l@à�{�2HA�h@è���r� AON@�Tߛ�^�AZ.@ø4��?� A2���Aa9?���O�6AK+?��m�vA�&?�4W���S A�$?Ô����A��>Ð�����A*�>�����A��>�U���jAu�>�@���Z�A��@���BX1;@Aw@�N�BhbJ@~o@�cM�B��P@=]@Û��B8�V@�X@Õ |B��_@5@�8CuBPg@�;@�~nB�)o@�%@àBgB��u@]@�!�`B�r~@�@���YB�a�@ �?�qBSBpO�@l�?�=�LBlc�@��?ÌYFB���@��?þ@BD{�@�?�5�9Bx��@)�?���3BP��@7�?�i-B��@;�?Â]%B4!�@\x?��{B�@Fb?�n�B��@Y?���B�D�@kB?��MB��@!?�{��Ad��@y?�+j�A,�@?�(t�A���@��>����A�@��>�6��A,��@��>äL�AH��@��>�n��AH��@Լ>��AX�@ �>Ì�vA�D�@3[>à�S@�L�@nF>�@�?�%�@�:>�@��H8�@u2>���>�|��@�.>�p��h&�@ (>à����6A�>È��N�AC�=À�#�0AA�=�HA���A��=��U^�z�A��=�|�� Ai�=���G)B���@LP>�X!B�1�@�2>Ø�B좩@\*>�V�B���@��=�&��At��@v�=�C�A]�@5w=ÄYhA���@TC=��;�@,��@�=����?���@�=�^����@R��AN>����B��7@H>È��Bx�D@��=��6�B��L@��=�W��Bp�R@@�=�9�{B��\@(�=��tBPNb@]�=�!�mBpRk@]�=É%gB�1r@ �=��n`B�?z@��=���YBm�@�=æSB,��@h=Ò�LB$L�@�`=�oPFBΌ@�O=��@B�`�@PB=÷�9B���@�:=è~3B|[�@�.=�P[-Bć�@q=�q]%B`��@� =ÐTB���@���܊�@��;��͘�l�@��;�����(1AĒ;�l�ԦAGz;�x�#���A�r;�(�@�ȔASm;�0J^���AAg;�H�{��AM];�xČ�� A�I;�L͛�آ Aw%;�\4����A];�����A;Ð���A��:Ìu��AС:����:�AQ�:�0V���-%A:�z
你能告诉我如何解码这个回复吗?目前我的代码如下:
endpoint = "http://localhost:4000/api/v1/test"
data = {"ip":"1.1.2.3"}
headers = {"Authorization":"Bearer "+ token}
response = requests.get(endpoint,data=data,headers=headers)
# request is OK, now I have to handle the content: decode JSON and save the STL content in a file