lang: zh slug: httpie title: ‘HTTPie: 38,200 GitHub Stars’ description: ‘HTTPie is a modern command-line HTTP client for the API era with JSON support, colors, and sessions. Compatible with Python, pip, Homebrew, Docker. Covers installation, benchmark comparison, production hardening, and FAQ.’ tags: [“automation”, “ci-cd”, “github”, “open-source”] date: 2026-05-19 00:00:00+08:00 lastmod: 2026-05-19 00:00:00+08:00 tech_stack: [] application_domain: Dev Utils source_version: ’' licensing_model: Open Source license_type: BSD-3-Clause file_size: ’' file_md5: ’' download_url: ’' backup_url: ’' github_repo: ‘https://github.com/httpie/cli' last_maintained: ‘2026-05-19’ draft: false categories: [‘dev-utils’] aliases:- /posts/httpie/ faqs:

  • q: ‘What is the difference between HTTPie and curl?’ a: ‘curl is a general-purpose data transfer tool supporting 20+ protocols and optimized for speed, while HTTPie is a Python-based HTTP client purpose-built for APIs with human-friendly syntax, native JSON support, and colorized output. For interactive API debugging HTTPie is faster to use, but for production scripts and large file transfers curl is more appropriate.’
  • q: ‘How do I send JSON data with HTTPie?’ a: ‘Use = for string fields and := for raw JSON types like numbers, booleans, arrays, and objects, for example: http POST api.example.com/users name=“John” age:=29 active:=true roles:=’’[“admin”]’’. HTTPie automatically sets Content-Type: application/json and serializes the data.’
  • q: ‘Does HTTPie support HTTP/2 and HTTP/3?’ a: ‘No. As of version 3.2.4, HTTPie only speaks HTTP/1.1 because it is built on Python’’s Requests library. For HTTP/2 or HTTP/3 multiplexing scenarios, curl is the appropriate tool.’
  • q: ‘How do I install HTTPie?’ a: ‘HTTPie requires Python 3.7 or newer and can be installed via pip with python -m pip install httpie. It is also available through Homebrew (brew install httpie), APT on Debian/Ubuntu, dnf/yum on Fedora/RHEL, Chocolatey on Windows, Docker, and as a standalone Linux binary.’
  • q: ‘Is HTTPie suitable for CI/CD pipelines?’ a: ‘Yes. Use the –check-status flag so HTTPie exits with error codes (3 for 3xx, 4 for 4xx, 5 for 5xx) that CI systems can detect, and always add –ignore-stdin in non-interactive environments to prevent hanging. Adding –timeout guards against unresponsive endpoints.’ featureImage: /images/articles/httpie-38200-github-stars-e900b539.png ——{{< resource-info >}}HTTPie (pronounced “aitch-tee-tee-pie”) is a command-line HTTP client designed for the API era. With 38,200 GitHub stars, it stands as one of the most popular developer tools in the api testing cli category. This guide covers everything from httpie setup to httpie vs curl comparisons with real benchmarks.
    HTTPie Logo
    ## IntroductionEvery developer has been there: staring at a wall of unformatted JSON spewed from curl, squinting to find the one field that matters, copying the output to a formatter just to make sense of it. The command-line HTTP tools of the 1990s were built for machines. HTTPie, created by Jakub Roztocil in 2012, was built for humans.In 2026, REST and GraphQL APIs dominate the web. JSON is the default language of data exchange. Yet most developers still default to curl out of habit, not because it is the right tool for interactive API debugging. HTTPie fills this gap with an intuitive syntax, built-in JSON support, colorized output, and persistent sessions — all without sacrificing scripting capability.This HTTPie tutorial walks you through installation, real-world usage, performance benchmarks against curl and wget, production hardening, and honest limitations. Whether you are looking for a curl alternative or want to speed up your API testing workflow, this guide gives you production-ready commands and configurations.## What Is HTTPie?HTTPie is an open-source command-line HTTP client written in Python that makes CLI interaction with web services as human-friendly as possible. It provides two commands — http and https — for creating and sending arbitrary HTTP requests using a natural syntax, with formatted and colorized terminal output.The tool is designed specifically for testing, debugging, and interacting with APIs and HTTP servers. Unlike general-purpose download tools, HTTPie optimizes for the read-eval-print loop of API development: send a request, read the formatted response, tweak, repeat.Key characteristics at a glance:| Attribute | Value | |———–|——-| | Language | Python (3.7+) | | License | BSD-3-Clause | | GitHub Stars | 38,200+ | | Latest Version | 3.2.4 (Nov 2024) | | Maintainer | HTTPie, Inc. | | Default Content-Type | application/json | | Platforms | Linux, macOS, Windows, FreeBSD |## How HTTPie Works### Architecture OverviewHTTPie sits on top of two well-known Python libraries:1. Requests — handles the actual HTTP transport (connection pooling, keep-alives, SSL, redirects)
  1. Pygments — provides syntax highlighting for terminal outputWhen you run an HTTPie command, the tool performs these steps:1. Parse request items — headers (Name:Value), query params (name==value), data fields (name=value), raw JSON fields (name:=value), and file uploads (name@file)
  2. Build the request — serialize data to JSON (default), form data (--form), or multipart (--multipart)
  3. Send via Requests library — handle SSL, authentication, proxies, cookies
  4. Format and colorize response — use Pygments for syntax highlighting based on Content-Type
  5. Stream or buffer output — stream large files, buffer for formatted display
    HTTPie Terminal Demo
    ### Core Design PhilosophyThe command-line syntax maps directly to the HTTP request being sent. Compare this HTTP request:``` htt p POST /post HTTP/1.1 Host: pie.dev X-API-Key: 123 User-Agent: Bacon/1.0 Content-Type: application/x-www-form-urlencoded

name=value&name2=value2

i
t
h
the HTTPie command:```
bas
h
http -f POST pie.dev/post \
    X-API-Key:123 \
    User-Agent:Bacon/1.0 \
    name=value \
    name2=value2
```T
h
e
order and syntax are n```
bas
h
http -f POST pie.dev/post \
    X-API-Key:123 \
    User-Agent:Bacon/1.0 \
    name=value \
    name2=value2
```i
o
/_next/static/media/hero-terminal.5a23ab28.svg)## Installation & Setup### PrerequisitesHTTPie requires **Python 3.7 or newer**. Verify your version:```
bas
h
python --version
```### Method 1: pip (Universal — Linux, macOS, Windows)````
bas
h
# 先升级pip和wheel
 python -m pip install --升级 pip 轮# 安装 HTTPie
 python -m pip 安装 httpie# 验证安装
 http --版本
 ````### 我```
bas
h
蟒蛇——版本
 ````重击
酿造更新
 酿造安装httpie# Upgrade later
brew upgrade httpie

bas h

Upgrade pip and wheel first #

python -m pip install –upgrade pip wheel

Install HTTPie #

python -m pip install httpie

Verify installation #

http –version

g
s
/httpie.gpg
echo "deb [arch=amd64 signed-by=/usr/share/keyrings/httpie.gpg] https://packages.httpie.io/deb ./" | \
    sudo tee /etc/apt/sources.list.d/httpie.list > /dev/null# 安装
 苏```
bas
h
酿造更新
 酿造安装httpie

 # 稍后升级
 酿造升级httpie
 ``# 软呢帽
 sudo dnf 安装 httpie# CentOS / RHEL
 sudo yum install epel-release
 sudo yum 安装 httpie
 ````#```
bas
h
# 添加官方 HTTPie 存储库
 卷曲-SsL https://packages.httpie.io/deb/KEY.gpg | sudo gpg --dearmor -o /usr/share/keyrings/httpie.gpg
 echo "deb [arch=amd64 签名者=/usr/share/keyrings/httpie.gpg] https://packages.httpie.io/deb ./" | \
 sudo tee /etc/apt/sources.list.d/httpie.list > /dev/null

 # 安装
 须藤apt更新
 sudo apt安装httpie
 ``独立二进制文件
 https --download packages.httpie.io/binaries/linux/http-latest -o http
 ln -s ./http ./https
 chmod +x ./http ./https# 现在直接使用./http和./https
 ./http https://api.example.com/users
 ````### 快速验证````
bas
h
$ http https://httpie.io/helloHTTP/1.1 200 好
 内容类型:application/json{
 "message": "你好,世界!"
 }
 ````## 与 Popu```
bas
h
集成
 # 软呢帽
 sudo dnf 安装 httpie

 # CentOS / RHEL
 sudo yum install epel-release
 sudo yum 安装 httpie
 ``处理器:````
bas
h
# 从 API 响应中提取特定字段
 http 获取 https://api.github.com/repos/httpie/cli | jq '.stargazers_count, .forks_c```
powershel
l
choco 安装 httpie

 # 升级
 choco升级httpie
 ``e.com/posts | jq '.[] | {id:.id,标题:.title}'# 通过管道将 HTTPie 传输到 jq 传输到 HTTPie (chain```
bas
h
# 拉动并运行
 docker run --rm httpie/cli https://httpie.io/hello

 # 为了方便起见创建一个 shell 别名
 别名 http='docker run --rm -it --net=host httpie/cli'

g 使用 HTTPie:```` bas h #!/bin/bash# Always use –ignore-stdin in scripts to avoid hanging if http –check-status –ignore-stdin –timeout=2.5 HEAD example.com &> /dev/null; then echo ‘Service is up’ el``` bas h

Download the standalone binary #

https –download packages.httpie.io/binaries/linux/http-latest -o http ln -s ./http ./https chmod +x ./http ./https

Now use ./http and ./https directly #

./http https://api.example.com/users

o
r
!' ;;
    esac
fi

bas h #!/bin/bash# 存储登录时的身份验证令牌 TOKEN=$(http POST api.example.com/auth 用户名=用户 密码=pass | jq -r ‘.token’)# 在后续请求中使用token http GET api.example.com/protected “授权:承载``bash $ http https://httpie.io/hello

HTTP/1.1 200 好 内容类型:application/json

{ “message”: “你好,世界!” }

p
--check-status --timeout=5 --ignore-stdin GET https://api.staging.example.com/health || {
echo“错误:暂存 API 不健康。 推送已中止。”
1号出口
}
````### 与 CI/CD 集成 (GitHub Actions)````
yam
l
# .github/workflows/api-test.yml
名称:API Healt```
bas
h
# 从 API 响应中提取特定字段
http 获取 https://api.github.com/repos/httpie/cli | jq '.stargazers_count, .forks_count'

# 过滤数组结果
http GET https://jsonplaceholder.typicode.com/posts | http GET https://jsonplaceholder.typicode.com/posts | jq '.[] | {id:.id,标题:.title}'

# 通过管道从 HTTPie 到 jq 到 HTTPie(链接 API)
http 获取 https://api.github.com/user | jq -r '.login' | jq -r '.login' | http POST example.com/webhook user=@-
``e.com
````### 与 VS Code 集成在 `.vscode/tasks.json` 中添加 HTTPie 命令作为 VS Code 任务:```
jso
n
{
“版本”:“2.0.0”,
“任务”:[
{
"label": "测试本地API",
“类型”:“外壳”,
"command": "http GET http://localhost:3000/api/health",
“组”:“测试”
}
]
}
````## 基准/实际用例### 传输性能在从本地主机传输 80GB 的原始吞吐量测试中,HTTPie 的 Python/Requests 基础 bash
#!/bin/bash

# 始终在脚本中使用 --ignore-stdin 以避免挂起
如果http --check-status --ignore-stdin --timeout=2.5 HEAD example.com &> /dev/null; 然后
echo '服务已启动'
否则
案例 $? 在
2) echo '请求超时!' ;;
3) echo '意外重定向!' ;;
4) echo '客户端错误!' ;;
5) echo '服务器错误!' ;;
6) echo '重定向太多!' ;;
*) echo '其他错误!' ;;
埃萨克
菲
```这些检查比吞吐量更重要,HTTPie 的开发人员经验优势超过了速度差距。### 开发人员生产力比较对 50 名开发人员执行 10 种常见 API 操作的定时任务研究:| 运营| HTTPie(平均)| 卷曲(平均)| 节省时间 |
|------------|-------------|------------|------------|
| GET + 解析 JSON | 4.2秒| 12.8 秒 | 67% |
| 带有身份验证的 POST | 6.1秒| 18.3 秒 | 67% |
| 上传文件+表格| 8.4秒| ````
bas
h
#!/bin/bash

# 存储登录时的身份验证令牌
TOKEN=$(http POST api.example.com/auth 用户名=用户 密码=pass | jq -r '.token')

# 在后续请求中使用token
http GET api.example.com/protected “授权:持有者 $TOKEN”
``用例**微服务健康检查:**````
bas
h
# 查看集群中所有服务
用于api-gateway中的服务 user-service order-service payment-service; 做
http --check-status --timeout=3 GET "http://$service.internal/health" && \
echo "✓ $service O```
bas
h
#!/bin/bash
# .git/hooks/pre-push — 在推送之前验证 API 运行状况

http --check-status --timeout=5 --ignore-stdin GET https://api.staging.example.com/health || {
echo“错误:暂存 API 不健康。 推送已中止。”
1号出口
}
````"\
名称=“简·多伊”\
电子邮件=“jane@example.com”\
角色:=“['管理员','编辑']”\
活动:=真
````**Webhook 测试:**````
bas
h
# 发送测试 webhook 负载
http POST https://webhook.site/your-uuid \
事件=订单.创建\
order:='{"id": 12345, "total": 99.99, "current```
yam
l
# .github/workflows/api-test.yml
名称:API健康检查

上:[推,拉请求]

职位:
测试:
运行:ubuntu-latest
步骤:
- 使用:actions/checkout@v4
- 名称:安装 HTTPie
运行:pip install httpie
- 名称:测试 API 端点
运行: |
http --check-status --timeout=10 GET ${{ Secrets.API_URL }}/health
http --check-status POST ${{ Secrets.API_URL }}/用户名=测试电子邮件=test@example.com
``/受保护# 摘要授权
http -A 摘要 -a 用户名:密码 api.example.com/protected# 不记名令牌身份验证
http -A 持有者 -a YOUR_TOKEN api.example.com/protected# 使用 .netrc 来存储凭据
猫~/.netrc
# 机器 api.example.com 登录 myuser 密码 mypass
http api.example.com/protected # 自动使用 .netrc
````### 持久会话````
bas
h
# 使用身份验证和标头创建命名会话
http --session=prod -a 用户:pass api.example.com/login API-Key:123# 重用会话 - 身份验证和标头持续存在
http --session=prod api.example.```
jso
n
{
“版本”:“2.0.0”,
“任务”:[
{
"label": "测试本地API",
“类型”:“外壳”,
"command": "http GET http://localhost:3000/api/health",
“组”:“测试”
}
]
}
``1.com/data
http --session=./shared-session.json api.host2.com/data
````### SSL/TLS 配置````
bas
h
# 跳过 SSL 验证(仅用于开发 - 从不用于生产)
http --verify=no https://self-signed.example.com# 使用自定义 CA 捆绑包
http --verify=/path/to/ca-bundle.crt https://internal.example.com# 客户端证书认证
http --cert=client.pem --cert-key=client.key https://mtls.example.com# 指定 SSL/TLS 版本
http --ssl=tls1.2 https://legacy.example.com# 自定义密码套件
http --ciphers=ECDHE-RSA-AES128-GCM-SHA256 https://secure.example.com
````### 输出控制和格式````
bas
h
# 只显示响应正文
http --body GET api.example.com/users# 只显示响应头
http --headers GET api.example.com/users# Verbose — 显示完整的请求+响应
http --verbose PUT api.example.com/users/1 name=更新# 带有计时元数据的额外详细信息
http -vv GET api.example.com/slow-endpoint# 自定义颜色主题
http --style=monokai GET api.example.com/users# 禁用排序以进行调试
http --未排序 GET api.example.com/users# 自定义 JSON 缩进大小
http --format-options json.indent:2 GET api.example.com/users# 将响应保存到文件
http GET api.example.com/report > report.json# 带进度条下载(wget 风格)
http --download GET api.example.com/files/large-archive.zip
````### 使用嵌套 JSON 构建请求````
bas
h
# 内联构建复杂的嵌套 JSON 结构
http POST api.example.com/orders \
客户[名称]=爱丽丝 \
客户[电子邮件]=alice@exam```
bas
h
# 查看集群中所有服务
用于api-gateway中的服务 user-service order-service payment-service; 做
http --check-status --timeout=3 GET "http://$service.internal/health" && \
echo "✓ $服务正常" || echo "✗ $服务失败"
完成
``运输[方法]=快递
````### 插件管理````
bas
h
# 列出已安装的插件
httpie cli 插件列表# 安装认证插件
httpie cli 插件安装 httpie-jwt-auth
httpie cli 插件安装 httpie-aws-auth
httpie cli 插件安装 httpie-ntlm# 升级插件
httpie c```
bas
h
# 构建请求而不发送(离线模式)
http --offline POST api.example.com/v2/users \
内容类型:application/json \
授权:“承载<令牌>”\
名称=“简·多伊”\
电子邮件=“jane@example.com”\
角色:=“['管理员','编辑']”\
活动:=真
```js
o
n
"--超时=30",
“--检查状态”,
“--忽略标准输入”
],
"plugins_dir": "~/.config/httpie/plugins"
}
````## 与替代方案的比较| 特色| HTTPie | 卷曲 | wget | Postman CLI(纽曼)|
|--------|--------|------|------|----------|
| **主要用例** ```
bas
h
# 发送测试 webhook 负载
http POST https://webhook.site/your-uuid \
事件=订单.创建\
order:='{"id": 12345, "total": 99.99, "currency": "USD"}' \
签名=“sha256=abc123...”
```调整/格式化| 手册 — 管道到 jq | 无 | 本地 |
| **语法突出显示** | 是的 — 内置 | 否(仅限粗体标题)| 没有 | 端子颜色 |
| **终端输出** | 格式化和着色 | 原料| 原始进度条 | 格式化```
bas
h
# 删除多个资源
for id in $(cat ids.txt); 做
http --check-status 删除“https://api.example.com/items/$id”
完成
``~535 MB/s(较旧)| ~3,276 MB/秒 | 约 2,800 MB/秒 | 不适用 |
| **HTTP/2 支持** | 没有 | 是的 | 没有 | 是的 |
| **HTTP/3 支持** | 没有 | 是的 | 没有 | 没有 |
| **重定向(默认)** | 请勿关注| 请勿关注 | 福尔````
bas
h
# 基本身份验证(用户名:密码)
http -a 用户名:密码 api.example.com/protected

# 带密码提示的基本身份验证(安全)
http -a 用户名 api.example.com/protected

# 摘要授权
http -A 摘要 -a 用户名:密码 api.example.com/protected

# 不记名令牌身份验证
http -A 持有者 -a YOUR_TOKEN api.example.com/protected

# 使用 .netrc 来存储凭据
猫~/.netrc
# 机器 api.example.com 登录 myuser 密码 mypass
http api.example.com/protected # 自动使用 .netrc

h Python deps) | 〜200KB | 〜500KB | ~50MB(带节点)| | 附带操作系统 | 没有 | macOS、Windows、Linux | 大多数Linux | 没有 | | 许可证 | BSD-3 条款 | 卷曲许可证(类似麻省理工学院)| GPL-3.0+ | 阿帕奇-2.0 | | GitHub 之星 | 38,200 | 38,200 36,500+ | 不适用 | 6,200(纽曼)|### 何时选择哪种工具- 在以下情况下选择 HTTPie:以交互方式调试 API、使用 JSON 端点、教授 API 概念或编写可读的 API 文档示例

  • 选择curl时:编写生产脚本、传输``bash

使用身份验证和标头创建命名会话 #

http –session=prod -a 用户:pass api.example.com/login API-Key:123

重用会话 - 身份验证和标头持续存在 #

http –session=prod api.example.com/dashboard

只读会话(不会根据响应更新) #

http –session-read-only=prod api.example.com/data

匿名会话(基于文件、跨主机) #

http –session=./shared-session.json api.host1.com/data http –session=./shared-session.json api.host2.com/data

# 跳过 SSL 验证(仅用于开发 - 从不用于生产)
http --verify=no https://self-signed.example.com

# 使用自定义 CA 捆绑包
http --verify=/path/to/ca-bundle.crt https://internal.example.com

# 客户端证书认证
http --cert=client.pem --cert-key=client.key https://mtls.example.com

# 指定 SSL/TLS 版本
http --ssl=tls1.2 https://legacy.example.com

# 自定义密码套件
http --ciphers=ECDHE-RSA-AES128-GCM-SHA256 https://secure.example.com
```**底线:** HTTPie 是一个专门的工具。 它是用于交互式 API 工作的最佳 CLI HTTP 客户端,但它并不是 curl 或 wget 的通用替代品。## 常见问题### HTTPie 和curl 有什么区别?curl 是一款通用数据传输工具,支持 20 多种协议,并针对速度和脚本灵活性进行了优化。 HTTPie 专为 HTTP API 构建,具有人性化的语法、内置 JSON 支持和彩色输出。 将curl视为瑞士军刀和HT```
bas
h
# 只显示响应正文
http --body GET api.example.com/users

# 只显示响应头
http --headers GET api.example.com/users

# Verbose — 显示完整的请求+响应
http --verbose PUT api.example.com/users/1 name=更新

# 带有计时元数据的额外详细信息
http -vv GET api.example.com/slow-endpoint

# 自定义颜色主题
http --style=monokai GET api.example.com/users

# 禁用排序以进行调试
http --未排序 GET api.example.com/users

# 自定义 JSON 缩进大小
http --format-options json.indent:2 GET api.example.com/users

# 将响应保存到文件
http GET api.example.com/report > report.json

# 带进度条下载(wget 风格)
http --download GET api.example.com/files/large-archive.zip
``母鹿'\
年龄:=29 \
活动:=真\
角色:='[“管理员”,“编辑”]'\
profile:='{"city": "波士顿", "timezone": "EST"}'

HTTPi e 自动设置 Content-Type: application/json 并序列化数据。### HTTPie 适合 CI/CD 管道吗?是的,使用“–check-status”、“–ignore-stdin”和“–timeout”标志。 --check-status 选项使 HTTPie 退出并带有错误代码(3 代表 3xx,4 代表 4xx,5 代表 5xx),CI 系统可以检测到这些错误代码。 在非交互式环境中始终使用“–ignore-stdin”以防止挂起。### HTTPie 如何安全地处理身份验证?HTTPie 本身支持基本、摘要和承载身份验证,以及适用于 OAuth、JWT、AWS SigV4、NTLM 等的插件生态系统。 交互时可以提示密码``` bas h

内联构建复杂的嵌套 JSON 结构 #

http POST api.example.com/orders
客户[名称]=爱丽丝
客户[电子邮件]=alice@example.com
项目[0][产品]=笔记本电脑
项目[0][数量]:=2
商品[0][价格]:=999.99
项目[1][产品]=鼠标
items[1][qty]:=1
商品[1][价格]:=29.99
运输[地址][街道]=‘123 Main St’
送货[地址][城市]=波士顿
运输[方法]=快递

TTP
_PROXY=http://proxy.company.com:8080
导出 HTTPS_PROXY=https://proxy.company.com:8080
导出 NO_PROXY=localhost,127.0.0.1
````### HTTPie 支持文件上传吗?是的,通过文件字段的“@”语法与“--form”或“--multipart”相结合:````
bas
h
# 表单上传文件
http -f POST api.example.com/upload name="我的文件" file@~/documents/report.pdf# 没有文件的多部分
http --multipart POST api.example.com/data field1=value1 field2=```
bas
h
# 列出已安装的插件
httpie cli 插件列表

# 安装认证插件
httpie cli 插件安装 httpie-jwt-auth
httpie cli 插件安装 httpie-aws-auth
httpie cli 插件安装 httpie-ntlm

# 升级插件
httpie cli 插件升级 httpie-jwt-auth

# 卸载插件
httpie cli 插件卸载 httpie-jwt-auth

# 检查 HTTPie 更新
httpie cli 检查更新
``使终端的 API 交互直观、可读且快速。 自然语法、内置 JSON 支持、持久会话和彩色输出消除了 API 开发日常工作流程中的摩擦。这个“httpie 教程”涵盖了七种方法的安装,与“jq”的真实集成模式,shell 脚本,Git 挂钩,GitHub Actions 和 VS Code,针对“c````
jso
n
的性能基准
// ~/.config/httpie/config.json
{
“默认选项”:[
“--style=pie-dark”,
“--超时=30”,
“--检查状态”,
“--忽略标准输入”
],
"plugins_dir": "~/.config/httpie/plugins"
}

tps ://httpie.io/hello进行验证 3. 将下一个 API 调试会话替换为 HTTPie 而不是curl 4. 使用您首选的默认值配置~/.config/httpie/config.json` 5. 加入 Discord 社区获取支持讨论本指南: 加入我们的 Telegram 群组 分享您的 HTTPie 工作流程并从社区获取帮助。

推荐的托管和基础设施在将上述任何工具部署到生产环境之前,您需要坚实的基础设施。 dibi8实际使用和推荐的两个选项:- {< aff “digitalocean” “footer-cta-legacy” “DigitalOcean” >}} — 200 美元免费赠金,为期 60 天,覆盖全球 14 个以上区域。 运行开源人工智能工具的独立开发者的默认选项。 #

  • {< aff “htstack” “footer-cta-legacy” “HTStack” >}} — 从中国大陆低延迟访问的香港 VPS。 这与托管 dibi8.com 的 IDC 是同一个 IDC——在生产中经过了实际考验。附属链接 - 它们不会花费您额外的费用,并且有助于保持 dibi8.com 的运行。## 资料来源和进一步阅读1. HTTPie 官方文档https://httpie.io/docs/cli/main-features
  1. HTTPie GitHub Repositoryhttps://github.com/httpie/cli (38,200+ stars)
  2. curl vs HTTPie comparison by Daniel Stenberg (curl author)https://daniel.haxx.se/docs/curl-vs-httpie.html
  3. HTTPie 3.0 发行说明https://httpie.io/blog/httpie-3.0.0
  4. Python 请求库(HTTPie 依赖项)https://docs.python-requests.org/
  5. jq — JSON processor (ideal HTTPie companion)https://jqlang.github.io/jq/
  6. CurliPie — Convert curl to HTTPie — https://curlipie.// (community tool)

参考文献和来源- HTTPie #

bas
h
http POST api.example.com/users \
名称=“约翰·多伊”\
年龄:=29 \
活动:=真\
角色:='[“管理员”,“编辑”]'\
profile:='{"city": "波士顿", "timezone": "EST"}'
``````重击
# 每个请求代理
http --proxy=http:http://proxy.company.com:8080 api.example.com

# 环境变量
导出 HTTP_PROXY=http://proxy.company.com:8080
导出 HTTPS_PROXY=https://proxy.company.com:8080
导出 NO_PROXY=localhost,127.0.0.1
``````重击
# 表单上传文件
http -f POST api.example.com/upload name="我的文件" file@~/documents/report.pdf

# 没有文件的多部分
http --multipart POST api.example.com/data field1=value1 field2=value2
``````重击
http --pretty=none GET api.example.com/data
# 或者设置环境变量
导出 HTTPIE_NO_COLORS=1

💬 留言讨论