Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Add .netrc support when using --auth-type bearer

Đang mở
#1,569 0 bình luận 9 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
authentication, cli

Hướng nghiên cứu

Bắt đầu bằng cách truy vết cách --auth-type bearer xử lý thông tin xác thực và cách cơ chế xác thực basic hiện có đọc .netrc. So sánh ví dụ machine/password được yêu cầu với hành vi xh được liên kết, sau đó xác minh rằng header bearer được tạo mà không có token hard-coded và ghi lại entry .netrc bắt buộc nếu cần.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement new

Checklist

  • I've searched for similar feature requests. The closest I found is where this was implemented in xh

Enhancement request

When using https, I don't want to have to hard-code my token in all scripts, rather I would like to have a central location where the token can be read from. This already works for the basic authentication type, but not, as far as I can tell, for the bearer auth type.

If this is implemented, then this enhancement request is to document it clearly, what needs to be in the file as https://httpie.io/docs/cli/netrc does not seem to cover it.


Problem it solves

I'm always frustrated when writing a script that I need to hard code the token in it, as it makes the script harder to share.


Additional information, screenshots, or code examples

This is implemented in xh and with the following in the .netrc:

machine host.local.lan password SecretToken

then

xh --json --auth-type bearer "https://host.local.lan/rest/api/latest/…"

Correctly sends the header:

Authorization: Bearer SecretToken

It would be great if httpie would support this same functionality.

Ngôn ngữ chính
Python
Star
38.6k
Fork
4k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của httpie/cli

Tất cả issue của httpie/cli

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.