storing httpie output with colors in document -
I would like to use httpie to generate documentation for a reinst web service
'Server ping', 'http -v get: 8080 / ping' 'submit document', 'http -v post: 8080 / document name = asdf'
And captures well-formatted output in a document.
Is there any way to do this?
You can also use ( pip install pygments
). This cleaner should provide the HTML, and it also gives you the option of choosing one of the many panning styles.
{# stylesheet: echo & lt; Style & gt; 'Pygmentize -S default -f html echo' & lt; / Style> HTTP request as HTTP: http --print = H httpbin.org/post Hello = World | Pygmentize -f html -l http / dev / stdin # JSON request body as HTML: http --print = B httpbin.org/post Hello = World | Pygmentize -f html -l json / dev / stdin} & gt; Request.html
Output:
& lt; Style & gt; ... & lt; / Style & gt; & Lt; Div class = "highlight" & gt; & Lt; Pre & gt; & Lt; Span class = "nf" & gt; POST & lt; / Span & gt; & Lt; Span class = "nn" & gt; / Post & lt; / Span & gt; & Lt; Span class = "kr" & gt; HTTP & lt; / Span & gt; & Lt; Span class = "o" & gt; / & Lt; / Span & gt; & Lt; Span class = "m" & gt; 1.1 & lt; / Span & gt; & Lt; Span class = "na" & gt; Content-length & lt; / Span & gt; & Lt; Span class = "o" & gt;: & lt; / Span & gt; & Lt; Span class = "l" & gt; 18 & lt; / Span & gt; & Lt; Span class = "na" & gt; Accept-encoding & lt; / Span & gt; & Lt; Span class = "o" & gt;: & lt; / Span & gt; & Lt; Span class = "l" & gt; Gzip, deflate & lt; / Span & gt; & Lt; Span class = "na" & gt; Accept & lt; / Span & gt; & Lt; Span class = "o" & gt;: & lt; / Span & gt; & Lt; Span class = "l" & gt; Application / JSN & lt; / Span & gt; & Lt; Span class = "na" & gt; User-agent & lt; / Span & gt; & Lt; Span class = "o" & gt;: & lt; / Span & gt; & Lt; Span class = "l" & gt; HTTP8 / 0.8.0 & lt; / Span & gt; & Lt; Span class = "na" & gt; Host & lt; / Span & gt; & Lt; Span class = "o" & gt;: & lt; / Span & gt; & Lt; Span class = "l" & gt; Httpbin.org & lt; / Span & gt; & Lt; Span class = "na" & gt; Content-type & lt; / Span & gt; & Lt; Span class = "o" & gt;: & lt; / Span & gt; & Lt; Span class = "l" & gt; App / Jason; Charset = utf-8 & lt; / Span & gt; & Lt; / Pre & gt; & Lt; / Div & gt; & Lt; Div class = "highlight" & gt; & Lt; Pre & gt; & Lt; Span class = "p" & gt; {& Lt; / Span & gt; & Lt; Span class = "nt" & gt; & Amp; Quot; Hello & amp; Quot; & Lt; / Span & gt; & Lt; Span class = "p" & gt;: & lt; / Span & gt; & Lt; Span class = "s2" & gt; & Amp; Quot; World & amp; Quot; & Lt; / Span & gt; & Lt; Span class = "p" & gt;} & lt; / Span & gt; & Lt; / Pre & gt; & Lt; / Div & gt;
Comments
Post a Comment