postdown / Postdown

Generate markdown API document from Postman.
GNU General Public License v3.0
76 stars 26 forks source link

[bug] python 3.9 UnicodeDecodeError: 'gbk' codec can't decode byte 0x81 in position 220 #7

Open askme-gpt opened 4 years ago

askme-gpt commented 4 years ago
PS C:\Users\admin\Desktop> postdown  .\passport.postman_collection.json xxx.md                                          Traceback (most recent call last):
  File "C:\Users\admin\AppData\Local\Programs\Python\Python39\Scripts\postdown-script.py", line 11, in <module>
    load_entry_point('Postdown==1.0.11', 'console_scripts', 'postdown')()
  File "c:\users\admin\appdata\local\programs\python\python39\lib\site-packages\postdown\cmdline.py", line 14, in execute
    parse(in_file, out_file)
  File "c:\users\admin\appdata\local\programs\python\python39\lib\site-packages\postdown\parser.py", line 16, in parse
    collection = json.load(f)
  File "c:\users\admin\appdata\local\programs\python\python39\lib\json\__init__.py", line 293, in load
    return loads(fp.read(),
UnicodeDecodeError: 'gbk' codec can't decode byte 0x81 in position 220: illegal multibyte sequence

json content:

{
    "info": {
        "_postman_id": "9ad6cff4-241c-426e-a422-cca71d567ae1",
        "name": "xxxx",
        "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
    },
    "item": [
        {
            "name": "登录验证码",
            "request": {
                "method": "POST",
                "header": [],
                "body": {
                    "mode": "urlencoded",
                    "urlencoded": [
                        {
                            "key": "scene",
                            "value": "login",
                            "type": "text"
                        },
                        {
                            "key": "language",
                            "value": "zh",
                            "type": "text"
                        },
                        {
                            "key": "telephone",
                            "value": "15623890321",
                            "type": "text",
                            "disabled": true
                        },
                        {
                            "key": "country_code",
                            "value": "+86",
                            "type": "text"
                        },
                        {
                            "key": "brand",
                            "value": "Mindmap",
                            "type": "text"
                        },
                        {
                            "key": "email",
                            "value": "776937862@qq.com",
                            "type": "text"
                        }
                    ]
                },
                "url": {
                    "raw": "{{xxxx}}/api/captchas",
                    "host": [
                        "{{xxxx}}"
                    ],
                    "path": [
                        "api",
                        "captchas"
                    ]
                },
                "description": "登录验证码"
            },
            "response": []
        },
        {
            "name": "验证身份",
            "request": {
                "method": "GET",
                "header": [],
                "url": {
                    "raw": "{{xxxx}}/backend/validation/identity?identity_token=19987145,xxx,99c825fe25f2c3cc44cda2e51458e47e,8",
                    "host": [
                        "{{xxxx}}"
                    ],
                    "path": [
                        "backend",
                        "validation",
                        "identity"
                    ],
                    "query": [
                        {
                            "key": "identity_token",
                            "value": "19987145,xxx,99c825fe25f2c3cc44cda2e51458e47e,8"
                        }
                    ]
                }
            },
            "response": []
        },
        {
            "name": "登录",
            "request": {
                "method": "POST",
                "header": [
                    {
                        "key": "identity_token",
                        "value": "17443861,xxx,ccsad234,2",
                        "type": "text",
                        "disabled": true
                    },
                    {
                        "key": "Content-Type",
                        "value": "application/json",
                        "type": "text"
                    }
                ],
                "body": {
                    "mode": "urlencoded",
                    "urlencoded": [
                        {
                            "key": "telephone",
                            "value": "18611370423",
                            "description": "测试一下",
                            "type": "text"
                        },
                        {
                            "key": "password",
                            "value": "CGLwabxewu3261qY",
                            "description": "2344",
                            "type": "text"
                        },
                        {
                            "key": "brand",
                            "value": "Apowersoft",
                            "description": "21414",
                            "type": "text"
                        },
                        {
                            "key": "registed_app",
                            "value": "mindmap",
                            "description": "14124",
                            "type": "text"
                        },
                        {
                            "key": "language",
                            "value": "zh",
                            "description": "124124",
                            "type": "text"
                        }
                    ]
                },
                "url": {
                    "raw": "{{xxxx}}/api/sessions",
                    "host": [
                        "{{xxxx}}"
                    ],
                    "path": [
                        "api",
                        "sessions"
                    ]
                },
                "description": "https://xxxx.xxx.com/api/sessions"
            },
            "response": []
        },
        {
            "name": "获取session Copy",
            "request": {
                "method": "POST",
                "header": [
                    {
                        "key": "identity_token",
                        "value": "17443861,xxx,ccsad234,2",
                        "type": "text"
                    },
                    {
                        "key": "",
                        "value": "",
                        "type": "text"
                    }
                ],
                "url": {
                    "raw": "{{xxxx}}/api/sessions",
                    "host": [
                        "{{xxxx}}"
                    ],
                    "path": [
                        "api",
                        "sessions"
                    ]
                },
                "description": "https://xxxx.xxx.com/api/sessions"
            },
            "response": []
        }
    ],
    "protocolProfileBehavior": {}
}
askme-gpt commented 4 years ago

I fix this bug , https://github.com/ShuiPingYang/YspPostdown

xiaorui16888 commented 2 years ago

I fix this bug , https://github.com/ShuiPingYang/YspPostdown

我使用了你的。但是遇到了这个问题。 image