Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Make option redirect output from `--output/-o` to `stdin`

Aperta
#1,591 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
python
Ambito
cli

Direzione di ricerca

Inizia in httpie/cli/argparser.py, in _setup_standard_streams(), dove il traceback mostra che seek(0) viene chiamato sul flusso di output, e segui come --output viene gestito tramite httpie/core.py. Riproduci il comando con -o - e una risposta binaria; il lavoro è completato quando l'output raggiunge stdout e può essere convogliato a head o xxd senza l'errore di seekability.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement new

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 
Lingua principale
Python
Stelle
38.6k
Fork
4k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di httpie/cli

Tutte le issue di httpie/cli

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.