Make option redirect output from `--output/-o` to `stdin`
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
- 55/100
Hướng nghiên cứu
Bắt đầu trong httpie/cli/argparser.py tại _setup_standard_streams(), nơi traceback cho thấy seek(0) đang được gọi trên luồng đầu ra, và theo dõi cách --output được xử lý thông qua httpie/core.py. Tái hiện lệnh với -o - và một phản hồi nhị phân; hoàn tất khi đầu ra đến stdout và có thể được pipe tới head hoặc xxd mà không gặp lỗi seekability.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Checklist
- I've searched for similar feature requests.
Enhancement request
I want to be able to redirect the output when using the --output/-o flag to the stdin like this:
http www.example.com/?req=index.html --output -
Currently if I run it this way, it shows this error message:
Traceback (most recent call last):
File "/home/user/.local/bin/http", line 8, in <module>
sys.exit(main())
File "/home/user/.local/lib/python3.10/site-packages/httpie/__main__.py", line 9, in main
exit_status = main()
File "/home/user/.local/lib/python3.10/site-packages/httpie/core.py", line 162, in main
return raw_main(
File "/home/user/.local/lib/python3.10/site-packages/httpie/core.py", line 77, in raw_main
parsed_args = parser.parse_args(
File "/home/user/.local/lib/python3.10/site-packages/httpie/cli/argparser.py", line 172, in parse_args
self._setup_standard_streams()
File "/home/user/.local/lib/python3.10/site-packages/httpie/cli/argparser.py", line 250, in _setup_standard_streams
self.args.output_file.seek(0)
io.UnsupportedOperation: File or stream is not seekable.
Problem it solves
I know if the output format is normal we don't have to use this. But when the output is binary or the file contains some null bytes somewhere like %00 http won't show the output. But we can rather use the --output/-o to redirect the binary to a file.
I don't want to redirect to a new file, I just want to check the file content in a single command. This is more productive because I can now redirect the input stream to other programs like head, xxd etc.
Like this:
http example.com/binary -b --output - | head | xxd
- 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
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của httpie/cli
-
new
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
bug new
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
-
argparser.py: HTTPieArgumentParser has high cyclomatic complexity and mixed responsibilities Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
browser-use/browser-use#5905 ·
-
type: enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
ynput/ayon-python-api#363 ·
-
bug needs triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
modelscope/FunASR#3728 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
open-compass/opencompass#2655 ·