{"id":23845770,"url":"https://github.com/kingjem/curl-to-json","last_synced_at":"2026-02-21T14:33:10.624Z","repository":{"id":270733002,"uuid":"896925508","full_name":"KingJem/curl-to-json","owner":"KingJem","description":"Convert curl cmd to json data with flag","archived":false,"fork":false,"pushed_at":"2024-12-24T05:01:59.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-11T03:51:47.561Z","etag":null,"topics":["cmd","curl","curlconvert","json"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KingJem.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-01T16:36:50.000Z","updated_at":"2024-12-24T05:02:02.000Z","dependencies_parsed_at":"2025-01-02T18:36:55.511Z","dependency_job_id":"bc4360fd-d995-4076-a200-bc87f360e3fb","html_url":"https://github.com/KingJem/curl-to-json","commit_stats":null,"previous_names":["kingjem/curl-to-json"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/KingJem/curl-to-json","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KingJem%2Fcurl-to-json","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KingJem%2Fcurl-to-json/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KingJem%2Fcurl-to-json/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KingJem%2Fcurl-to-json/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KingJem","download_url":"https://codeload.github.com/KingJem/curl-to-json/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KingJem%2Fcurl-to-json/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262513634,"owners_count":23322663,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cmd","curl","curlconvert","json"],"created_at":"2025-01-02T20:26:19.795Z","updated_at":"2025-10-16T20:39:36.249Z","avatar_url":"https://github.com/KingJem.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Trans curl request to  json data\n\n将参数转化为json 的时候尽量使用 -- 之后的值，作为字典的键。\n这个库的目的是将curl 发送请求的参数转化为json 格式，方便在python 中使用。\n\ncurl 功能很强大，支持的参数也很多，这里只做了部分的解析\n\n重点放在curl HTTP发送请求的方面.\n\n其他一些特性，--ipv4,--ipv6,本地文件读取，指定dns 寻址服务器\nDoH,ftp 等协议暂未支持\n\n支持的参数\n\n- `-X`, `  --request` 支持的请求方法，\n\n- `--http2` 是否使用http2 协议 默认为否\n\n- `-d`,`--data` 支持, 支持在一行命令中多次使用`-d` 参数，此时HTTP 请求头中\n  `Content-Type : application/x-www-form-urlencoded`\n\n  使用该参数，请求自动转化为POST.\n\n- `-H`,`--header`  添加HTTP请求头,支持多行\n\n- `-I`,`--head` 发送HEAD请求，并打印header，支持\n\n- `-s`,`--silent`, 不输出任何东西，只返回HTTP 头\n\n- `-v`, `--verbose` 输出通信的整个过程，用于调试\n\n- `-b`, `--cookie` cookie 支持多个-b 参数，不支持文件读取\n\n- `-A`, `--user-agent` 设置User-Agent,curl 默认的User-Agent 为 curl/version,本项目默认为空\n\n- `--compressed` 是否压缩请求\n\n- `-k`, `--insecure` 允许不验证服务器的证书\n\n- `-u`, `--user` 用户名:密码\n\n- `-L`, `--location` 允许自动跟随重定向\n\n- `-I`,`--include` 打印头信息\n\n- `-x`，`--proxy` 使用代理 代理 格式为：hostname:port，如果没有scheme 默认使用http\n\n- `-U`, `--proxy-user` 代理用户名密码 ,格式为：username:password 如果有会自动将账号密码添加到代理url 中\n\n- `-u`, `--user` basic 认证，格式为：username:password，输出为headers 中的Authorization\n\n- `--connect-timeout` 连接超时时间\n\n- `--referer` 请求头中的referer\n\n## usage\n\n1. 命令行中使用\n```shell\npython -m curl_to_json  curl_to_json curl -X GET http://example.com\n```\n2. 也可以直接使用 \n```shell\ncurl_to_json curl -X GET http://example.com\n```\n\n3. 也可以使用 以下格式\n```shell\ncurl_to_json \"curl -X GET http://example.com\"\n```\n\n4. 在python 代码中使用\n```python\nfrom curl_to_json import parse\n\ncmd = 'curl -X GET http://example.com'\n\nprint(parse(cmd))\n\n```\n\n       \n## Reference\n\n*1. [curl 的用法指南](https://www.ruanyifeng.com/blog/2019/09/curl-reference.html)*\n\n*2. [Linux命令大全-curl](https://hezhiqiang.gitbook.io/linux/ming-ling/curl)*\n\n*3. [Uncurl](https://github.com/spulec/uncurl)*\n\n*4. [curl 在线手册](https://man.cx/curl)*\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingjem%2Fcurl-to-json","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkingjem%2Fcurl-to-json","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkingjem%2Fcurl-to-json/lists"}